vineri, 14 ianuarie 2011

"Converting" an XmlNode to and XmlDocument in C#


private void Output(XmlNode xnodeOutput,bool bOutputToFile)
{
try
{

XmlDocument xdocOutput = new XmlDocument();

XmlNode xnodeTemp = xdocOutput.ImportNode(xnodeOutput, true);

XmlElement xWC = xdocOutput.CreateElement("whatever");

xdocOutput.AppendChild(xnodeTemp);



The first element will never by shown anyway(assuming you do xdocOutput.Save(afile.xml)) so it can have any name.

Niciun comentariu:

Trimiteți un comentariu