only My site

Wednesday, July 23, 2008

Attributes collection


using System;
using System.IO;
using System.Xml;

public class Sample
{
public static void Main(){

XmlDocument doc = new XmlDocument();
doc.LoadXml("" +
"" +
"
");

//Create an attribute collection.
XmlAttributeCollection attrColl = doc.DocumentElement.Attributes;

Console.WriteLine("Display information on each of the attributes... \r\n");
foreach (XmlAttribute attr in attrColl){
Console.Write("{0}:{1} = {2}", attr.Prefix, attr.LocalName, attr.Value);
Console.WriteLine("\t namespaceURI=" + attr.NamespaceURI);
}
}
}

No comments: