You can use xpath to pick out the data from xml file.
When you get xml file from webservice , you can use code below to do this.
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("XMLFile13.xml"));
XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
xnm.AddNamespace("abc", "http://www.secretsite.com/");
XmlNode node = doc.SelectSingleNode("//abc:ErrorDescription",xnm);
string test = node.InnerText;
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
I can not consume webservice , so I store the xml data in xml file . The content in xml file is the same as the content returned from web method.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
<returnMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.secretsite.com/">
<ErrorName>Success</ErrorName>
<ErrorDescription>Rejected - Duplicate from same vendor</ErrorDescription>
<LeadID>12731285</LeadID>
<ClientAvailable>false</ClientAvailable>
</returnMessage>
You can get the value above from webservice right ? After that , you can use Class XmlDocument to load the data.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
xmlfile13.xml and not xmlfile14.xml or anything else ?
Yes, the name can be anything else.[:)]
In my testing environment, I can not invoke web method , so I stored the xml data in one file called xmlfile13.xml as the return value from webservice.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kolucoms6
0 Points
14 Posts
XML and HTML
Mar 27, 2008 01:48 PM|LINK
I am a beginner when we consider XML.
So, I will need help if anyone can guide me on how to convert below XML file to HTML Display.
Reason for Converting XML to HTML is I dotn want my user to see [url]http://www.secretsite.com[/url] link.
So, HTML will show...
ErrorDescription : Rejected - Duplicate from same vendor LeadID : 12731285
ClientAvailable : false
Any guidance will definitely help.. Its BIT urgent..
I heard I have to use XSL Transformations (XSLT) but it goes top over my head.
Further Details :
*********************
When I use in My ASP file
<form action="http://apps.secretsite.com/Supplier...asmx/InsertLead" method="post" enctype="application/x-www-form-urlencoded" name="AA" id="AA">
It returns me the XML file as shown above.
So, Currently it is
Form --- > InsertLead --- > XML Output
I am looking forward to
Form --- > InsertLead --- > XML Output---> HTML Output
Possible ?
I found one link but still thinking how to use it...
[url]http://developer.apple.com/internet/webcontent/xmlhttpreq.html[/url]
kolucoms6
0 Points
14 Posts
Re: XML and HTML
Mar 27, 2008 10:59 PM|LINK
Refresh
Samu Zhang -...
All-Star
62163 Points
6101 Posts
Re: XML and HTML
Mar 30, 2008 06:53 AM|LINK
Hi kolucoms6 ,
You can use xpath to pick out the data from xml file.
When you get xml file from webservice , you can use code below to do this.
XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("XMLFile13.xml")); XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace("abc", "http://www.secretsite.com/"); XmlNode node = doc.SelectSingleNode("//abc:ErrorDescription",xnm); string test = node.InnerText;Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kolucoms6
0 Points
14 Posts
Re: XML and HTML
Mar 31, 2008 05:15 PM|LINK
Regarding XMLFile13.xml , But I cant make out the name of the file it returns
Samu Zhang -...
All-Star
62163 Points
6101 Posts
Re: XML and HTML
Apr 01, 2008 02:28 AM|LINK
Hi kolucoms6,
I can not consume webservice , so I store the xml data in xml file . The content in xml file is the same as the content returned from web method.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kolucoms6
0 Points
14 Posts
Re: XML and HTML
Apr 01, 2008 04:15 AM|LINK
Sorry but I am confused about what you said
Samu Zhang -...
All-Star
62163 Points
6101 Posts
Re: XML and HTML
Apr 01, 2008 07:03 AM|LINK
Hi kolucoms6,
The content of xmlfile13.xml is
<returnMessage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.secretsite.com/">
<ErrorName>Success</ErrorName>
<ErrorDescription>Rejected - Duplicate from same vendor</ErrorDescription>
<LeadID>12731285</LeadID>
<ClientAvailable>false</ClientAvailable>
</returnMessage>
You can get the value above from webservice right ? After that , you can use Class XmlDocument to load the data.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kolucoms6
0 Points
14 Posts
Re: XML and HTML
Apr 01, 2008 07:49 AM|LINK
Sorry for my questions, but why the file name is
xmlfile13.xml and not xmlfile14.xml or anything else ?
Samu Zhang -...
All-Star
62163 Points
6101 Posts
Re: XML and HTML
Apr 01, 2008 08:11 AM|LINK
Hi kolucoms6 ,
Yes, the name can be anything else.[:)]
In my testing environment, I can not invoke web method , so I stored the xml data in one file called xmlfile13.xml as the return value from webservice.
Samu Zhang
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
kolucoms6
0 Points
14 Posts
Re: XML and HTML
Apr 01, 2008 09:21 AM|LINK
So, I have to first store/save it and can try the code you sent me ?
But how to save it ?