开发者

how to pass xml document as a string to a asp.net webservice

Hi i have the xml document in my asp.net web application . I want to assign the xml document to a 开发者_如何学Gostring 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜