Gets the local name of the current node.
using System;
using System.IO;
using System.Xml;
public class Sample {
public static void Main() {
XmlTextReader reader = null;
try {
reader = new XmlTextReader("book2.xml");
while (reader.Read()) {
if (reader.IsStartElement()) {
if (reader.Prefix==String.Empty)
Console.WriteLine("<{0}>", reader.LocalName);
else {
Console.Write("<{0}:{1}>", reader.Prefix, reader.LocalName);
Console.WriteLine(" The namespace URI is " + reader.NamespaceURI);
}
}
}
}
finally {
if (reader != null)
reader.Close();
}
}
}
Related examples in the same category