Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
While it's not valid XHTML, lots of XML still use the <foo> construct. But when I use XmlTextReader to read this element, I get a nodetype of Element, with no indication that it's also and EndElement. Is there any way to deal with this?

UPDATE from OP:
You can check reader.IsEmptyElement, and if it's a self-closing tag it's true, false otherwise.
Posted
Updated 27-Jul-10 18:31pm
v2

Internally, I don't think that it is, I think that it still seperates it so the next node is the end node.
 
Share this answer
 
Comments
[no name] 27-Jul-10 20:38pm    
Not sure what you mean. If the text is <foo> and you use xmltextreader.read, you get an entry with nodetype element, and the next read takes you to the next statement.
[no name] 27-Jul-10 20:39pm    
Sorry, it seems to be eating my xml. the item is and element with a / at the end specifying that it's a self contained element.
OK, I found the answer. You can check reader.IsEmptyElement, and if it's a self-closing tag it's true, false otherwise.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900