Xml question

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

How do I best check if an Xml node is complete in itself.
I mean if there is an / in the xml node itself.
For example
<parameter id="1234567" type="pa-00920-gmhwi" disabled="false"/>
This xml node is complete in itseld because there is an / at the end.

//Tony
 
When using XmlReader, this is the IsEmptyElement property.

With DOMs it might be harder to identify...

Marc
 
Tony said:
How do I best check if an Xml node is complete in itself.
I mean if there is an / in the xml node itself.
For example
<parameter id="1234567" type="pa-00920-gmhwi" disabled="false"/>
This xml node is complete in itseld because there is an / at the end.

How about
<foo></foo>
that is an empty element as well. Is that different in your opinion to
<foo/>
or
<foo />
?

Check whether reading out the
http://msdn.microsoft.com/en-us/library/system.xml.xmlelement.isempty.aspx
gives you the information/distinction you are looking for, your
description is not clear enough to me to judge whether that property helps.

LINQ to XML has a similar property
http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.isempty.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top