n***@io7m.com
2016-05-27 13:41:35 UTC
Hello.
I'm dealing with a text format that allows characters that are not
allowed by XML. I'm referring to those characters in particular areas
of the BMP [U+0001, U+0009], etc:
https://en.wikipedia.org/wiki/Valid_Characters_in_XML#XML_1.0
I'm trying to serialize the text as XML 1.0 and therefore obviously
need to escape some characters. XOM transparently escapes <, &, etc,
and this is fine. However, it raises an exception if I try to append
text to a child that contains forbidden codepoints such as U+0001.
If I try to manually escape characters myself by writing  and so
on, XOM escapes the ampersand and I end up with &#0001.
What's the correct way to insert the characters myself such that
they'll be escaped?
M
I'm dealing with a text format that allows characters that are not
allowed by XML. I'm referring to those characters in particular areas
of the BMP [U+0001, U+0009], etc:
https://en.wikipedia.org/wiki/Valid_Characters_in_XML#XML_1.0
I'm trying to serialize the text as XML 1.0 and therefore obviously
need to escape some characters. XOM transparently escapes <, &, etc,
and this is fine. However, it raises an exception if I try to append
text to a child that contains forbidden codepoints such as U+0001.
If I try to manually escape characters myself by writing  and so
on, XOM escapes the ampersand and I end up with &#0001.
What's the correct way to insert the characters myself such that
they'll be escaped?
M