.NET and XML
.NET and XML Contents
Summary An easy example to compare an XML element with the System.Xml.XmlTextReader
In the previous example you learned to read a xml file with the XmlTextReader. However it displayed the data from all xml elements. In this short example you will see how to display the data only from the MainCategory element.
The trick is to use the Name property of the XmlTextReader class. This property returns the name of the current node. All you need is a if statement which compares the returned value of the Name property with MainCategory.
As you can see in the if block I am using a new function called ReadString(). This must be placed on a element or a text node to return the string, otherwise it will return an empty string.
Our code from the previous example is now change to this one.
Partners
Dream.In.Code dotNet Slackers dotNet Spider Your HTML Source VisualBuilder.com DevGuru Planet Source Code ZVON.ORG Web Design ASPAlliance XML Pitstop Scripts
The Spot 4 SAP Bitshop Web Hosting