I am trying to generate some XML on-the-fly in Scala.
I want to use a numeric character reference inside the XML and write out the resultant XML to an output stream.
Example:
val myXml = <body>Hello World</body>
val writer = new java.io.FileWriter("test")
scala.xml.XML.write(writer, myXml, "utf-8", false, null)
8198 is unicode for a tiny space character.
After the above snippet is run, the contents of the file "test" are
<body>Hello World</body>
What I am expecting instead is,
<body>Hello World</body>
Edit: Learnt how to escape XML in SO