changing the innerxml of a XElement

  • Thread starter Thread starter Michael Soza
  • Start date Start date
Michael Soza said:
Is there a way to modify the innerxml of a XElement?
It wouldn't be innerxml, it'd be xelement, xattribute or other members of
System.Xml.Linq
 
well none of the above replies provide a solution, and Raj I think you
didn't read de question, I'm talking about XElement object that is part of
Linq to Xml that like say Andy doesn't have that property. Stackoverflow
guys gave me the following answers that Is exactly what I need.
Supposed we want to create a Xelement based in a innerxml that comes from
other place, so building node by node isn't practical.
XElement nuevotv = new XElement("Treeview",
new XAttribute("id", temp),
new XAttribute("date",
DateTime.Now.ToLocalTime().ToString()),
XElement.Parse(StringFromOtherPlace));

The key is the method Parse of the Xelement that accept a string like
argument.
Thanks anyway.
 

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

Back
Top