The node to be inserted is from a different document context

P

Paulo

Tried:

exportapedido ExpPedido = new exportapedido(); //Calling WebService, already
added web Reference on project

XmlDocument docXML = new XmlDocument();

try
{
XmlNode node = ExpPedido.ExportaPedido(719); //WebService returns XMLNode
docXML.AppendChild(node); //--> error: The node to be inserted is from a
different document context
GridView1.DataSource = node; //-->test to show on grid and shows OK!
GridView.DataBind();
docXML.Save("teste.xml"); //I'm trying to save xml
}
catch (Exception err)
{
Response.Write("<script> alert('" + err.Message.Replace("'", "") +
"')</script>");
}

how to fix error: "The node to be inserted is from a different document
context"

VWD C# Express 2008

Many Thanks
 
B

bruce barker

as the error say, you can insert a node into a xml document, that was not
created by that document. you will have copy the node values, or use GetXml,
LoadXml

-- bruce (sqlwork.com)
 
P

Paulo

But how do I transfer the contents from a node (generated by WebService) to
a XMLDoc and save it to a XML file..?

Can it be done ? if yes, please show me some code.

Thanks!
 

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

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top