Is there a good way to copy an XmlNode element's tag contents? What I need
to do is take something like <tag att="one">Some text</tag>, and return <tag
att="one"> only.
At the moment, I creating a stringbuilder, and then looping through the
attributes, but this seems error prone. Is there a built in way to do this?
StringBuilder sb = new StringBuilder();
sb.Append("<" + node.Name);
foreach (XmlAttribute attr in node.Attributes) {
sb.Append(" ");
sb.Append(attr.Name);
sb.Append("=\"");
sb.Append(attr.Value);
sb.Append("\"");
}
sb.Append(">");
Thanks,
Erick
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.