storing an xml element

N

NotYetaNurd

I have a situation , where in I had to store a bit of information about a
treenode in Tag .....

like this
"<shorcut key="M1" startpos="33" >System.Windows.MessageBox.Show("");
</shorcut>"

ideally i should be creating an xmlelement add attributes and store the
xmlelement in Tag...

but am not able to do this
i tried
XmlElement xle = new XmlElement();
but got this exception
'System.Xml.XmlElement.XmlElement()' is inaccessible due to its protection
level ...

How do i declare an xmlelement and add attributes to it and then add to Tag
Property ..

Regards
 
N

Nicholas Paldino [.NET/C# MVP]

NotYetaNurd,

You have to call the CreateElement method on the XmlDocument class that
you want to add it to. Remember, you have to add the element to the node
using the Append method once you have created your element.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top