tags:

views:

76

answers:

1

Hi, at the moment I'm trying to implement a method in which the server creates an XmlDocument object and sends it to the client (using AJAX) which then stores the object as a var. I wished to send that variable from the client back to the server but when the server receives it, it's no longer recognised as an XmlDocument object, instead it comes back as a arrays of arrays of objects within objects.

is there something I'm missing?

+1  A: 

I would suggest writing the XML document to a string and storing that.

StringWriter sw = new StringWriter();
XmlTextWriter tx = new XmlTextWriter(sw);
doc.WriteTo(tx);

string xmlString = sw.ToString();

Then you can load the XML string back into the XML document:

XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);

If you need more help, give more specifics of how you are implementing the AJAX.

If you need help on implementation details, let us know.

Chris