Re: [xsl] Illegal xml chars

Subject: Re: [xsl] Illegal xml chars
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 13 Dec 2007 16:04:36 +0100
Waqar Ali wrote:

I have an illegal character in my xml (0x08 or &#x8;) and when I tries to transform it using xslt, the parser (MS .NET) gives me an error(hexadecimal value 0x08, is an invalid character). I tried everything: using different encoding, wrapping my xml data in CDATA tags but nothing seems
to be working. What do you suggest?

If you are using .NET 2.0 or later then you can use &#x8; (a character reference) in your XML 1.0 documents parsed by an XmlReader with XmlReaderSettings.CheckCharacters set to false e.g. C#
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.CheckCharacters = false;
using (XmlReader reader = XmlReader.Create(@"file.xml", readerSettings))
// now use that reader here e.g. to be on topic on the list
XPathDocument doc = new XPathDocument(reader);
// ...

Using the character literally however is not possible.

If you need more help on that then I suggest we move to the newsgroup microsoft.public.dotnet.xml as we are getting off-topic here on the XSL list.


	Martin Honnen

Current Thread