XmlDocument.InnerXml is null, but InnerText is not
Posted
by Adam Neal
on Stack Overflow
See other posts from Stack Overflow
or by Adam Neal
Published on 2010-05-07T16:53:41Z
Indexed on
2010/05/07
16:58 UTC
Read the original article
Hit count: 303
I'm using XmlDocument
and XmlElement
to build a simple (but large) XML document that looks something like:
<Widgets>
<Widget>
<Stuff>foo</Stuff>
<MoreStuff>bar</MoreStuff>...lots more child nodes
</Widget>
<Widget>...lots more Widget nodes
</Widgets>
My problem is that when I'm done building the XML, the XmlDocument.InnerXml
is null, but the InnerText
still shows all the text of all the child nodes.
Has anyone ever seen a problem like this before? What kind of input data would cause these symptoms? I expected the XmlDocument
to just throw an exception if it was given bad data.
Note: I'm pretty sure this is related to the input data as I can only reproduce it against certain data sets. I also tried escaping the data with SecurityElement.Escape but it made no difference.
© Stack Overflow or respective owner