MSXML2.SAXXMLReader.6.0 doesn't parse & # x5;
I am writing xml from C # using .net framework XmlTextWriter. It works fine. Some of the lines I write out contain the value of character 5 (note that I do not mean character "5", but I mean the value ascii 5).
Now I understand from the xml spec that this character is illegal in the xml. However, I don't care if it's illegal, I want it in my XML document (non-compliant). This means that I can write a string that could potentially contain some binary data in the document.
Ok, so System.Xml.XmlTextWriter will write these illegal xml characters ok and encode it in xml as "x;"
. But then I want to read them in a C ++ application using MSXML2.SAXXMLReader.6.0. This parser raises a fatalError when it encounters one of these characters.
I've tried modifying some properties of the analyzer to make it work. As I understand it, IE used this parser internally and I can load illegal xml from IE ok. So how does IE manage to parse it when I can't.
Am I missing something? Whether IE is using a different parser. Is there a way to get the MSXML2.SAXXMLReader.6.0 parser to work? Do I need to use a different parser (if so, can you recommend one that has the source code so I can fix it if it doesn't do what I want)?
There is a property that I can set on the .Net parser to allow these illegal characters. I am probably looking for an equivalent that I can use from C ++ with a SAX parser. http://msdn.microsoft.com/en-us/library/system.xml.xmlwritersettings.checkcharacters.aspx
Thanks a
lot , -Scott
NOTE I do not believe that the CDATA section will allow this character to be encoded. Look here:
http://msdn.microsoft.com/en-us/library/ms256076(VS.85).aspx
and even if it did. I don't want to use CDATA sections, I want to use a character in the attribute value. I also understand that I can base64 encode it, but I don't want to do that either ... I want to break the law, I want to be able to parse illegal xml.
a source to share
No, it is not possible to parse control characters in XML.
To be precise, this would make your documents something other than XML documents.
This is the tricky part of the specification. If you want to parse illegal characters, you will need to write your own NON-COMPLIANT parser.
In accordance with:
a source to share