0

I have small requirement that i want to read text area rows and need to display it like xml format.I tried with following code, it successfully gives the alert with xml structure. But here I would like to show the entire xml data in separate HTML file with xml data, Once we click on submit button whole the xml data wants to display some other page Please help. I tried with following code,

var url= "url";
var urlValues;
$(document).ready(function(){
    $("#saveImgID").click(function(){
              var xmlStart =  "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Rowsets>";
              var xmlEnd = "</Rowset></Rowsets>";
        var lines = $('#fileContent1').val().split(/\n/);
     var texts = []
     for (var i=0; i < lines.length; i++) {
           if (/\S/.test(lines[i])) {
             texts.push($.trim(lines[i]));
          }
     }
     xml += xmlEnd;
     xmlData = xml;
     urlValues = url+"?importData="+xmlData;
     window.location.href=urlValues;
   });     
}); 

Here is the fiddle

Rajasekhar
  • 2,215
  • 3
  • 23
  • 38
  • you could show it in a `
    ` block by setting the innerHTML (in jQuery - `$('pre').html()`) and then have a submit button from that preview?
    – tophallen Jan 08 '15 at 07:46
  • Use `document.implementation.createDocument()`, similar question http://stackoverflow.com/q/3191179/3008050 – karan3112 Jan 08 '15 at 07:46

0 Answers0