javascript - Get outer xml structure of xml file to a string with jquery -
i don't know if possible or not javascript/jquery. have number of xml files read , disply xpath, xml files structured html elements this:
<?xml version="1.0" encoding="utf-8"?> <catalog> <outcome> <title>1.1</title> <section> <p>some text intro: <ul> <li>part of list</li> <li>part of list</li> </ul> </p> <p>more text</p> </section> </outcome> <outcome> <title>1.2</title> <section> <p>some text intro: <ul> <li>part of list</li> <li>part of list</li> </ul> </p> <p>more text</p> </section> </outcome> </catalog>
i want display children , descendants of select element. using javascript, know how load xml , select element need, , know how loop through nodes, possible node , descendants string? take string , append div element.html("string"). let css style elements needed. possible javascript? know xsl whole page, need small part of large xml.
can using jquery treating html
$(function() { $.get('data.xml', function(xml) { $(xml).find('outcome').each(function() { $('body').append($(this).html()); }); }, 'html'); });
if need manipulate new html prior inserting ( adding classes etc) failry trivial
Comments
Post a Comment