BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


.NET and XML
How to check if the XML elements contains any attributes with XmlTextReader
How to avoid to read the XML declaration with XmlTextReader?
How to create a XML file with XmlTextWriter?
Is it possible to add attributes with XmlTextWriter?
How to Write a Comment to a XML File with XmlTextWriter and WriteComment?
How to add the XML Declaration with XmlTextWriter and WriteStartDocument?
How to use Indentation in XmlTextWriter?
What is the usage of WriteFullEndElement and how do I use?
How to include a CData block with XmlTextWriter and WriteCData?
How to write raw XML with XmlTextWriter?
How to add a namespace with the XmlTextWriter and WriteStartAttribute?
How to create a new xml file with XmlDocument?
How to create a xml on the fly?
How to use the Item property in XmlTextReader?
How to Create a Comment with XmlDocument and XmlComment?
How to Read a XML from a Stream with XmlTextReader?
How to Read a XML from a URL with the XmlTextReader?
How to auto-increment an unique ID in XML with XmlTextReader?
How to read Nodes with XmlNodeReader?
How to Get the Attribute Value with XmlNodeReader and GetAttribute?


 
 

<< XSLT 


By Sonu Kapoor
First Posted 02/05/2005
Times viewed 257

How to verify if an element is empty with XmlTextReader and IsEmptyElement?


Summary An example to check if the XML elelemt is empty or not.

What do I mean with an empty element? Simple, an empty element doesn't have a closing tag. These elements opens and closes in one tag. To close the tag you have to use / at the end of the tag. The following is an empty element. Notice the / at the end of the tag.

So how do you check whether this is an empty element or not with the XmlTextReader class? Luckily the XmlTextReader provides a property called IsEmptyElement. It will return true if it is an empty element and false if it isn't.

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (0 votes, average 0)

Your vote :  

<< XSLT 





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML