Wrox Programmer Forums
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2011, 06:23 AM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old October 20th, 2011, 07:10 AM
Authorized User
 
Join Date: Jul 2007
Posts: 29
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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>

Last edited by codehelp; October 20th, 2011 at 07:43 AM.. Reason: Sample code
 
Old October 20th, 2011, 11:10 PM
Authorized User
 
Join Date: Apr 2010
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by codehelp View Post
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..
 
Old October 21st, 2011, 12:38 AM
Authorized User
 
Join Date: Jul 2007
Posts: 29
Thanks: 2
Thanked 0 Times in 0 Posts
Default 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.





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP/XML Trying to delete a xmlnode Florian_mrt Classic ASP XML 1 March 20th, 2006 02:25 PM
xmldocument & xmlnode albusr .NET Web Services 2 December 20th, 2005 01:46 PM
Service returns xmlNode instead of xmlDocument! KC7ZDM .NET Web Services 0 February 18th, 2005 08:18 PM
Parsing Problem - help! philz XML 5 March 5th, 2004 05:28 AM





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