Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XmlLite issue - IXmlReader::IsEmptyElement()

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 2/7/2008 6:06:00 PM

alan.christensen@g... wrote:
> I have another problem with XmlLite losing it's state.
> <TTAG>&#x10</TTAG>
> I have an XML file where illegal data was entered.  (The value of
> &#x10 ).    Whenever the parser gets to that line it returns S_FALSE
> as a result, and then I can never seem to get it so sync up with
> another line.
> 
> How can I handle this error gracefully and not just bail out?

x10 is not an allowed character in XML 1.0 so an XML parser has to 
report that as a well-formedness error and stop parsing. I don't think 
XmlLite has a setting to change that.

With XmlReader in the .NET framework you can use CheckCharacters on 
XmlReaderSettings e.g.

       XmlReaderSettings settings = new XmlReaderSettings();
       settings.CheckCharacters = false;

       string xml = @"<foo>&#x10;</foo>";

       using (XmlReader reader = XmlReader.Create(new StringReader(xml), 
settings))
       {
         while (reader.Read())
         {
           if (reader.HasValue)
           {
             Console.WriteLine("Value is \"{0}\"", reader.Value);
           }
         }
       }

That way character _references_ to characters outside of the allowed 
range are not causing an error but literal characters still do.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent