Xml invalid character

  • Thread starter Thread starter Gabriele Poggi
  • Start date Start date
G

Gabriele Poggi

How can I load an xml document, with some invalid
character, with the method doc.load(), without exceptions?
I have already tried to insert a CDATA Sections in the
xml file source, but the result is the same.
Thanks..
Gabriele
 
Gabriele, the only way to get this to work is to fix/remove the invalid
character in your XML document. Valid XML may only contain certain
characters (http://www.w3.org/TR/REC-xml#charsets). Therefore, all
compliant XML parsers must throw an error/exception if they encounter a
character outside of those valid characters.
 
You might be able to use XmlReader or some such artifact which might give
you some chance to fix (or skip the node) while its reading the stuff.

Check out XmlTextReader.Read() for a brief example.
 
There is an XmlConvert class in System.Xml. You might see if any of its
methods will do the trick.

doug
 
Back
Top