1

I have an Json object or xml Data that I would like to preview this in html as React is doing: https://github.com/marushkevych/xml-display-component but I don't want to mix Javascript and Reactjs. I hope someone can help me.

Example of my Xml: I want this to show as a tree , as the same xml format.Click to see the example

Angela Pat.
  • 37
  • 2
  • 9

1 Answers1

0

You can use something like the vkBeautify Plugin.

http://www.eslinstructor.net/vkbeautify/

Or maybe write your own formatting logic.

If I get it right, you want to pretty print XML and JSON Data as HTML in a Webbrowser with Javascript.

Take a look at this Question: Pretty printing XML with javascript

Community
  • 1
  • 1
Scriptlabs
  • 498
  • 3
  • 16
  • Thanks for your reply... I can use a pretty print too that vkBeautify Plugin is doing. But I was looking for a module because I'd like to preview the xml with the possibility to show it as a Tree. https://raw.githubusercontent.com/marushkevych/xml-display-component/master/exmple.png – Angela Pat. Apr 06 '16 at 08:50
  • Try sth else... like_ http://www.levmuchnik.net/Content/ProgrammingTips/WEB/XMLDisplay/DisplayXMLFileWithJavascript.html – Scriptlabs Apr 06 '16 at 10:05
  • Thanks. But I don't have a static file, the xml is generated on Server . I think I need to build my logic... I am trying to find some modules and nothing, the only way I found React but Idk if is a good idea mix with React. Otherwise I can find a module to make Trees and modify it to implement xml tags. What do you think? – Angela Pat. Apr 06 '16 at 10:16
  • Did you see the LoadXmlString() Function? http://www.levmuchnik.net/Content/ProgrammingTips/WEB/XMLDisplay/DisplayXMLFileWithJavascript.html#Usage – Scriptlabs Apr 06 '16 at 10:18
  • I guess it ist exactly what you are looking for... http://www.levmuchnik.net/Content/ProgrammingTips/WEB/XMLDisplay/XMLDisplay.js AND http://www.levmuchnik.net/Content/ProgrammingTips/WEB/XMLDisplay/XMLDisplay.css – Scriptlabs Apr 06 '16 at 10:20
  • 1
    Hey Yes, THANKS, I was spending time trying to realise where to find the loadXmlString() function. and you got it. I am going to try this code. I will let you know how is going. – Angela Pat. Apr 06 '16 at 10:41
  • 1
    It's going great. Thanks – Angela Pat. Apr 06 '16 at 13:25