Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - XML parse validation >Thread Next - Re: XML parse validation Re: XML parse validationTo: NULL Date: 1/3/2008 4:07:00 PM sarosh.shirazi@g... wrote: > I'm facing an illegal character problem when I read an XML file. Below > code was used to do the reading. > > XmlReaderSettings settings = new XmlReaderSettings(); > settings.CheckCharacters = false; > > string fXmlFileName = _FilePath; > XmlReader reader = XmlReader.Create(fXmlFileName, > settings); > XML= new XPathDocument(reader); > > The exception comes on the constructor of XPathDocument. I want to > read the file overlooking the characters like � (UTF-8 encoding). A > solution pointed out to me was to parse it manually by reading it in > ascii and replacing the characters but this damages my performance > level so i want to avoid it. Any suggestion in this regard would be > most welcome... How can i avoid validation??? If you set CheckCharacters to false then the XmlReader allows character references like � so I am not sure why you get a parse error. Are you sure you have characters references like �? If you have such characters literally in the document then CheckCharacters set to false does not help. In that case the XML APIs do not help at all, you need to preprocess the document to get rid of those characters. -- Martin Honnen http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
