Hi i have the xml document in my asp.net web application . I want to assign the xml document to a string and pass that string to a asp.net webservice. Can anyone able to help me to do this ? Thank you
May be you need this:
XmlDocument xmlDoc = new XmlDocument();
StringWriter stringWriter = new StringWriter();
XmlTextWriter textWriter = new XmlTextWriter(stringWriter);
xmlDoc.WriteTo(textWriter);
string xmlText = stringWriter.ToString();
Try this code:
XmlDocument xml = new XmlDocument();
xml.Load("file1.xml");
string xmlString = xml.OuterXml;
and you can pass the xmlString.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.