[xsd-users] XML 1.1 and restricted characters

Eric Niebler eric at boostpro.com
Thu Apr 22 14:28:40 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi XSD gurus,

I have the following problem: sometimes characters that are invalid
according to the XML 1.0 spec (e.g. 0x1F) end up in my XML files. That
causes the resulting XML file to be unreadable. After some research and
experimentation, I've found that in XML 1.1, these "restricted
characters" are allowed as long as they are escaped (e.g. ).

What I need is (A) a way to configure XSD serialization so that it emits
the XML declaration as:

 <?xml version="1.1" ...?>

and (B) to translate restricted characters into their escaped
equivalents. Is there an easy way to do this?

I can probably accomplish (A) by writing out the declaration myself and
using the xml_schema::flags::no_xml_declaration flag. And I could do (B)
myself using an ostream filter that knows about restricted characters
and translates them (taking care somehow not to translate 0x1f if it
appears as a trailing byte of UTF-8-encoded character). Ugh! That seems
like a lot of work for something that IMO should be simple.

Thoughts?

- -- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJL0JVYAAoJEAeJsEDfjLbXTrkH/jz+EaI00sn2p0k9RXfeV4Ub
QZjYetjqrvVSg3qmB9z4TlWOjEn42vlxR5lV3TCTgfZ9/cgsTotK1HOPyivMi7ES
VT66dc0JXs0e4GDtWZJvY4OelltF68KaH1ggi8wp7pp5fa8iCCq5mBmoerEchKip
RfIpRw+lu3inkHw/iKI+XbOj12xtt80qqpkpt3/HX/4SSeBR/XyMOa07QGv30qVq
jvyC8VzqAEr1wwB1tB4AhLtzzszd2mvfcLMSCzgCMsM3Jl+Ul2drdr0m7HutKece
UMiKwcyG2Z3pPcCmDtVfsNq4SOZDAhJC2Is1ANK7IcfdQG4ZhaaufEBLaEQv/o4=
=a6yd
-----END PGP SIGNATURE-----



More information about the xsd-users mailing list