Gets a boolean value indicating whether the current node has any attributes. : XmlElement « XML « C# / C Sharp
- C# / C Sharp
- XML
- XmlElement
Gets a boolean value indicating whether the current node has any attributes.
using System;
using System.IO;
using System.Xml;
public class Sample
{
public static void Main()
{
XmlDocument doc = new XmlDocument();
doc.LoadXml("<book genre='Computer' ISBN='1-111111-11-1'>" +
"<title>C#</title>" +
"</book>");
XmlElement root = doc.DocumentElement;
if (root.HasAttributes)
root.RemoveAllAttributes();
Console.WriteLine(doc.InnerXml);
}
}
Related examples in the same category