I'm trying to read a XmlReader
into a XDocument
//GetContentStructureReader() retrieves the reader from an external source
XmlReader reader = GetContentStructureReader();
XDocument.Load(reader);
I keep getting the following exception with one specific data source:
System.ArgumentNullException was unhandled by user code Message=Value cannot be null. Parameter name: value Source=System.Xml.Linq ParamName=value StackTrace: at System.Xml.Linq.XAttribute..ctor(XName name, Object value) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r) at System.Xml.Linq.XContainer.ReadContentFrom(XmlReader r, LoadOptions o) at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Load(XmlReader reader)
So it seems that during the loading, at some point a XAttribute is being initialized with null value.
What is a null attribute in XML? I've tried examining the (6 megabyte) source document to correct the data, but in vain, since I don't know what kind of XML construct I'm looking for.
Is there a workaround for this?