0

I don't know how to explain this but here it goes. I have below data. (from sql column via select query)

< error>< exitcode>1< /exitcode>< details>Details< /details>< /error>

I want something in html where if you click Errors link. It will open a browser and produce below output.

'< error>< exitcode>1< /exitcode>< details>Details< /details>< /error>'

Can someone help me with this. Thanks.

Arnab Nandy
  • 6,472
  • 5
  • 44
  • 50
iGreenius
  • 33
  • 1
  • 5
  • Not sure I got you right, but if you want to convert your XML to HTML you can look up XSTL. Hope I am pointing you in the right direction. – Phoenix Apr 16 '15 at 04:56
  • I believe what your looking for is parseXML(). See [this question](http://stackoverflow.com/questions/6513953/adding-xml-dom-elements-with-jquery-is-it-possible) and [this tutorial](http://tech.pro/tutorial/877/xml-parsing-with-jquery) for more details. – CalebB Apr 16 '15 at 04:56
  • I am sending an html email and that "ErrorLink" will open in another browser showing the error details in xml format. – iGreenius Apr 17 '15 at 03:09

2 Answers2

0

You can just output the XML data inside of the <xmp> tag in your html page:

<xmp>  
<?xml version="1.0" encoding="unicode"?>  
 <error>
 <exitcode>1</exitcode>
 <details>Details</details>
</error>  
</xmp> 

and the display in browser is : enter image description here

chenzhongpu
  • 6,193
  • 8
  • 41
  • 79
  • Thanks for the swift response Chen.. I like the output - that is what I am looking for but can we do something like this. There is an HTML page where there is an [ErrorLink] and if you click that link, that "output" will show in another browser. – iGreenius Apr 16 '15 at 05:54
  • Assume that the `errorlink` is : ErrorLink. You just put the `XML` data inside the `` tag in the `errorPage.html`. – chenzhongpu Apr 16 '15 at 05:58
  • Nice! It worked Chen, I created two html files (errorPage.html and Main.html). Will this also work if they are in the same html file? – iGreenius Apr 16 '15 at 06:48
0

maybe you can have an anchor with a data uri with the error message in it

<a href="data:text/plain,< error>< exitcode>1< /exitcode>< details>Details< /details>< /error>">&lt; error>&lt; exitcode>1&lt; /exitcode>&lt; details>Details&lt; /details>&lt; /error></a>
Musa
  • 96,336
  • 17
  • 118
  • 137