0

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

1

2 Answers 2

1

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();
Sign up to request clarification or add additional context in comments.

Comments

0

Try this code:

XmlDocument xml = new XmlDocument();
xml.Load("file1.xml");
string xmlString = xml.OuterXml;

and you can pass the xmlString.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.