Problem loading XMLDocument with non standard tags

Posted by David Conde on Stack Overflow See other posts from Stack Overflow or by David Conde
Published on 2010-12-26T01:50:28Z Indexed on 2010/12/26 1:54 UTC
Read the original article Hit count: 522

Filed under:
|

Hi,

I have a code needed to load an XML document from a reader, something like this:

private static XmlDocument GetDocumentStream(string xmlAddress)
{
     var settings = new XmlReaderSettings();
     settings.DtdProcessing = DtdProcessing.Ignore;
     settings.ValidationFlags = XmlSchemaValidationFlags.None;

     var reader = XmlReader.Create(xmlAddress, settings);
     document.Load(reader);

     return document;
}

But in my XML document, I have nodes like this one:

<link rel="edit-media" title="Package" 
  href="Packages(Id='51Degrees.mobi',Version='0.1.11.9')/$value" />

Is to my understanding that the node should be like

<link rel="edit-media" title="Package"></link>

But, I don't create the Xml document and I certainly don't want to change it, but when I try to load the XML document, the document.Load line throws an exception. To be more specific, the XML file is the RSS source for the nuPack project.

Any ideas would be very appreaciated on how to be able to read this document properly.

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml