XML and HTMLhttp://forums.asp.net/t/1239355.aspx/1?XML+and+HTMLWed, 02 Apr 2008 07:09:45 -040012393552259335http://forums.asp.net/p/1239355/2259335.aspx/1?XML+and+HTMLXML and HTML <p>&nbsp;</p> <p>&nbsp;</p> <p>I am a beginner when we consider XML.</p> <p>So, I will need help if anyone can guide me on how to convert below XML file to HTML Display.</p> <p></p> <blockquote><span class="icon-blockquote"></span> <p></p> <p>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt; <br> - &lt;returnMessage xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xmlns:xsd=&quot;<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>&quot; xmlns=&quot;<a href="http://www.secretsite.com/">http://www.secretsite.com/</a>&quot;&gt;<br> &lt;ErrorName&gt;Success&lt;/ErrorName&gt; <br> &lt;ErrorDescription&gt;Rejected - Duplicate from same vendor&lt;/ErrorDescription&gt; <br> &lt;LeadID&gt;12731285&lt;/LeadID&gt; <br> &lt;ClientAvailable&gt;false&lt;/ClientAvailable&gt; <br> &lt;/returnMessage&gt;</p> </blockquote> <p></p> <p><br> &nbsp;</p> <p>&nbsp;</p> <p>Reason for Converting XML to HTML is I dotn want my user to see [url]http://www.secretsite.com[/url] link.</p> <p>So, HTML will show... </p> <p>ErrorDescription : Rejected - Duplicate from same vendor LeadID : 12731285<br> ClientAvailable : false</p> <p>Any guidance will definitely help.. Its BIT urgent..</p> <p>I heard I have to use XSL Transformations (XSLT) but it goes top over my head.</p> <p>Further Details :<br> *********************</p> <p>When I use in My ASP file </p> <p>&lt;form action=&quot;<a href="http://apps.secretsite.com/Supplier...asmx/InsertLead">http://apps.secretsite.com/Supplier...asmx/InsertLead</a>&quot; method=&quot;post&quot; enctype=&quot;application/x-www-form-urlencoded&quot; name=&quot;AA&quot; id=&quot;AA&quot;&gt;</p> <p>It returns me the XML file as shown above.</p> <p>So, Currently it is </p> <p>Form --- &gt; InsertLead --- &gt; XML Output</p> <p>I am looking forward to </p> <p>Form --- &gt; InsertLead --- &gt; XML Output---&gt; HTML Output</p> <p>Possible ?</p> <p>I found one link but still thinking how to use it...</p> <p>[url]http://developer.apple.com/internet/webcontent/xmlhttpreq.html[/url]</p> <p>&nbsp;</p> 2008-03-27T13:48:09-04:002260612http://forums.asp.net/p/1239355/2260612.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Refresh</p> 2008-03-27T22:59:30-04:002264381http://forums.asp.net/p/1239355/2264381.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi <strong>kolucoms6</strong> ,</p> <p>You can use xpath to pick out the data from xml file.</p> <p>When you get xml file from webservice , you can use code below to do this.</p> <p>&nbsp;<pre class="prettyprint">XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath(&quot;XMLFile13.xml&quot;)); XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable); xnm.AddNamespace(&quot;abc&quot;, &quot;http://www.secretsite.com/&quot;); XmlNode node = doc.SelectSingleNode(&quot;//abc:ErrorDescription&quot;,xnm); string test = node.InnerText;</pre>&nbsp;</p> 2008-03-30T06:53:50-04:002266841http://forums.asp.net/p/1239355/2266841.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Regarding XMLFile13.xml&nbsp;, But I cant make out the name of the file it returns</p> 2008-03-31T17:15:56-04:002267616http://forums.asp.net/p/1239355/2267616.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi kolucoms6,</p> <p>I can not consume webservice , so I store the xml data&nbsp;in xml file . The content in xml file is the same as the content returned from web method.</p> <p>&nbsp;</p> 2008-04-01T02:28:54-04:002267777http://forums.asp.net/p/1239355/2267777.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Sorry but I am confused about what you said </p> 2008-04-01T04:15:05-04:002268058http://forums.asp.net/p/1239355/2268058.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi kolucoms6,</p> <p>The content of xmlfile13.xml is </p> <p><br> &lt;<span class="tag">returnMessage</span><span class="attr"> xmlns:xsi=</span><span class="attrv">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span><span class="attr"> xmlns:xsd=</span><span class="attrv">&quot;http://www.w3.org/2001/XMLSchema&quot;</span><span class="attr"> xmlns=</span><span class="attrv">&quot;http://www.secretsite.com/&quot;</span>&gt;<br> &lt;<span class="tag">ErrorName</span>&gt;Success&lt;/<span class="tag">ErrorName</span>&gt; <br> &lt;<span class="tag">ErrorDescription</span>&gt;Rejected - Duplicate from same vendor&lt;/<span class="tag">ErrorDescription</span>&gt; <br> &lt;<span class="tag">LeadID</span>&gt;12731285&lt;/<span class="tag">LeadID</span>&gt; <br> &lt;<span class="tag">ClientAvailable</span>&gt;false&lt;/<span class="tag">ClientAvailable</span>&gt; <br> &lt;/<span class="tag">returnMessage</span>&gt; </p> <p>&nbsp;You can get the value above from webservice right ? After that , you can use Class&nbsp;XmlDocument to load the data.</p> <p>&nbsp;</p> 2008-04-01T07:03:54-04:002268144http://forums.asp.net/p/1239355/2268144.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Sorry for my questions, but why the file name is&nbsp;&nbsp;</p> <p>xmlfile13.xml and not xmlfile14.xml&nbsp; or anything else ?</p> 2008-04-01T07:49:52-04:002268187http://forums.asp.net/p/1239355/2268187.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi <strong>kolucoms6</strong> , </p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>kolucoms6</h4> <p>but why the file name is&nbsp;&nbsp;</p> <p>xmlfile13.xml and not xmlfile14.xml&nbsp; or anything else ?</p> <p></p> </blockquote> <p></p> <p>Yes, the name can be anything else.[:)]</p> <p>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.</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-04-01T08:11:56-04:002268309http://forums.asp.net/p/1239355/2268309.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>So, I have to first store/save it and can try the code you sent me ? </p> <p>But how to save it ?</p> 2008-04-01T09:21:19-04:002268316http://forums.asp.net/p/1239355/2268316.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Currently it is </p> <p>Form --- &gt; InsertLead --- &gt; XML Output</p> <p>I am looking forward to </p> <p>Form --- &gt; InsertLead --- &gt; XML---&gt; HTML Output</p> <p>&nbsp;</p> 2008-04-01T09:24:00-04:002268339http://forums.asp.net/p/1239355/2268339.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi <strong>kolucoms6</strong> ,</p> <p></p> <blockquote><span class="icon-blockquote"></span> <h4>kolucoms6</h4> <p>So, I have to first store/save it and can try the code you sent me ? </p> <p>But how to save it ?</p> <p></p> </blockquote> <p></p> <p>No , there is no need to save it . What is web method return type ?</p> <p>&nbsp;</p> 2008-04-01T09:32:45-04:002268385http://forums.asp.net/p/1239355/2268385.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Sorry, what do you mean by </p> <p>&quot;&nbsp;<strong>web method return type &quot; ?</strong></p> 2008-04-01T09:49:12-04:002268465http://forums.asp.net/p/1239355/2268465.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi <strong>kolucoms6</strong> ,</p> <p>&nbsp;<pre class="prettyprint">[WebMethod] public <u><em><strong>string</strong></em></u> HelloWorld() { return &quot;Aaa&quot;; }</pre><pre class="prettyprint">&nbsp;</pre><pre class="prettyprint">String is the type of retrun value. What is yours?</pre><pre class="prettyprint">&nbsp;</pre></p> 2008-04-01T10:28:32-04:002268491http://forums.asp.net/p/1239355/2268491.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>&nbsp;</p> <p>I am sending few values from my form&nbsp;to the backend and it returns me the XML file which get displayed in my Internet Explorer.</p> <p>&nbsp;</p> 2008-04-01T10:37:21-04:002268528http://forums.asp.net/p/1239355/2268528.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi kolucoms6,</p> <p>Ok, the web method may like this one.</p> <p>&nbsp;<pre class="prettyprint">[WebMethod] public string test2() { string xml = &quot;&amp;lt;root&gt;aaaa&lt;/root&gt;&quot;; Context.Response.ContentType = &quot;text/xml&quot;; return xml; }</pre> <P>&nbsp;So you can use code below to load xml data.</P><pre class="prettyprint"> <SPAN class=kwd>protected void</SPAN> Button1_Click(<SPAN class=kwd>object</SPAN> sender, EventArgs e) { localhost.Service1 ser = <SPAN class=kwd>new</SPAN> localhost.Service1(); <SPAN class=kwd>string</SPAN> xml = ser.test2(); XmlDocument doc = <SPAN class=kwd>new</SPAN> XmlDocument(); doc.LoadXml(xml); }</pre> </p> <p>&nbsp;localhost.Service is the stub of webservice&nbsp;in client side.</p> <p>&nbsp;</p> 2008-04-01T11:04:10-04:002268732http://forums.asp.net/p/1239355/2268732.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>i </p> 2008-04-01T12:33:24-04:002268733http://forums.asp.net/p/1239355/2268733.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>&nbsp;</p> <p>I am using Classic ASP.</p> 2008-04-01T12:33:25-04:002270336http://forums.asp.net/p/1239355/2270336.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>Hi <strong>kolucoms6</strong> ,</p> <p>This is asp.net forum . I am not familar with Classic&nbsp;asp.</p> <p>I found this article , hope it is helpful to you.</p> <p><a href="http://www.dotnetjunkies.com/Article/99CA4563-FBD4-411F-A9C6-FF9E8A0E664F.dcik">http://www.dotnetjunkies.com/Article/99CA4563-FBD4-411F-A9C6-FF9E8A0E664F.dcik</a></p> <p>I think the principle is the same.</p> <ul> <li>&lt;div mce_keep=&quot;true&quot;&gt;send one soap message to webservice.&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;recieve one soap message from webservice&lt;/div&gt; </li><li>&lt;div mce_keep=&quot;true&quot;&gt;parse the message and get value&lt;/div&gt;</li></ul> <p>&nbsp;</p> 2008-04-02T02:10:32-04:002270676http://forums.asp.net/p/1239355/2270676.aspx/1?Re+XML+and+HTMLRe: XML and HTML <p>&nbsp;</p> <p>Awesome example... Exactly what I was looking for.</p> <p>Now, I have an Instruction to use it as in my form&nbsp;</p> <p>&lt;form action=&quot;<a href="http://apps.secretsite.com/Supplier...asmx/InsertLead"><font color="#034efa">http://apps.secretsite.com/Supplier...asmx/InsertLead</font></a>&quot; method=&quot;post&quot; enctype=&quot;application/x-www-form-urlencoded&quot; name=&quot;AA&quot; id=&quot;AA&quot;&gt;</p> <p>For my ASP page, it will change to&nbsp;</p> <p>webServiceUrl = &quot;<a href="http://apps.secretsite.com/Suppliers/WebServices/InsertLeads.asmx/InsertLead?FirstName">http://apps.secretsite.com/Suppliers/WebServices/InsertLeads.asmx/InsertLead?FirstName</a>=&quot; &amp; Name</p> <p>Set node = myXmlDoc.documentElement.selectSingleNode(&quot;//LeadID&quot;) </p> <p>But&nbsp;I get an Error as :&nbsp;</p> <p>Error Type:<br> Microsoft VBScript runtime (0x800A01A8)<br> Object required: 'myXmlDoc.documentElement'<br> <b>/XML/MyXML.asp, line 19</b></p> <p>&nbsp;</p> 2008-04-02T06:15:13-04:00