output parsed raw xml using jquery

iiPunkey

New Member
Is it possible to parse some XML using $.parseXML(xmldata).Then to output what was parsed in, back out with tags and all.. I can only seem to get a text to output, there are no tags when outputting..The XML is later used to generate a form, atm clients are manually entering xml, I'm settings up a gui. Im trying to now pick up and generate a small editable section for each of the form elements the xml represents.. then once they update the form element I save the xml back to the hidden textarea which is saved to the database as raw xml(used to gen the final form).\[code\] $(document).ready(function(){ var xml = $('#form_template').val(); var trueXml = '<?xml version="1.0" encoding="UTF-8"?><form><localhost><formmanager><formpage><elements>' + xml + '</elements></formpage></formmanager></localhost></form>'; xmlDoc = $.parseXML(trueXml); $xml = $(xmlDoc); var $html = "<div style='width:695px;'>"; $html += "<ul id='sortable'>"; $xml.find('elements').children().each(function(){ //console.log($(this)); $html += "<li style='background-color:#333;color:#fff;margin:0 0 3px;list-style:none outside none;padding:6px;'>" + $(this).get(0).tagName + "</li>"; }); $html += "</ul>"; $html += "</div>"; $('#form_template_display-element').append($html); $('ul#sortable').children().each(function(){ console.log($(this).text()); $('#form_description').val($xml.find($(this).text()).get(0)); //return false; } );}) \[/code\]
 
Back
Top