p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Basics (http://p2p.wrox.com/forumdisplay.php?f=351)
-   -   xmlnode parsing problem (http://p2p.wrox.com/showthread.php?t=85411)

harshil.sh October 20th, 2011 06:23 AM

xmlnode parsing problem
 
i am creating a webservice client app
the following is webservice method syntax:
XmlNode serve.GetPolicyDetails(param1,param2);

as you can seen return type is an XmlNode object..
i have to make page where in it will print the output received from the webservice method on my .aspx page in XML format..

how should i do it
please can someone send me a sample code for it

codehelp October 20th, 2011 07:10 AM

See if this helps. Not exactly what you asked for but should be enough to get started.
http://www.codeproject.com/Answers/2...t.aspx#answer2

If that is taking too long then here is some code (very trivial though) that might help you.
Since your WS returns a node you can use the OuterXml method of XmlNode object to show the xml in your page.
Here is a sample:
<code>
string xmlString = @"<items><item1 id='1'>Text</item1><item2 id='2'>Text</item2></items>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlNode node = doc.SelectSingleNode(@"items/item1");
System.Console.WriteLine(node.OuterXml);
</code>

harshil.sh October 20th, 2011 11:10 PM

Quote:

Originally Posted by codehelp (Post 277573)
See if this helps. Not exactly what you asked for but should be enough to get started.
http://www.codeproject.com/Answers/2...t.aspx#answer2

If that is taking too long then here is some code (very trivial though) that might help you.
Since your WS returns a node you can use the OuterXml method of XmlNode object to show the xml in your page.
Here is a sample:
<code>
string xmlString = @"<items><item1 id='1'>Text</item1><item2 id='2'>Text</item2></items>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlNode node = doc.SelectSingleNode(@"items/item1");
System.Console.WriteLine(node.OuterXml);
</code>

First of all thanks for your effort.. but i have tried using node.outerxml method but it still returns only a concatinated string containing values of all child nodes together same as an innerxml method..

secondly i want to print the entire xml including the tags and everything that is returned by the webservice on my aspx page ...(XML output format how should i do that)... please its urgent.. please let me know as soon as possible..

codehelp October 21st, 2011 12:38 AM

Can you please give the code you already have?
 
Hi,
is it possible for you to post the code you already have?
That may help to understand what is not working properly.

Since the WS method returns a XmlNode, the OuterXml method should be able to do the job, since you say it doesnt please provide a sample code, I will be glad to respond.

Regards.


All times are GMT -4. The time now is 09:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.