1

i am struck in problem of writing to an XML file. I know how to read an xml file. Let me explain it clearly. I have to read the value from an xml file and pass it to a label or listbox and then write the value to another xml file. I did the first part of reading and i am struck in writing. I have gone through several queries in stackoverflow. But its not working for me. Help me out Here is the code which i used for writing

var v = new  XMLWriter();
   v.writeStartDocument(true);
   v.writeElementString('option','Hello World');
   v.writeAttributeString('foo','bar');
   v.writeEndDocument();
   console.log( v.flush() );
Praveen Singh
  • 534
  • 2
  • 8
  • 23

1 Answers1

3

From here

function test(){    
 var v = new  XMLWriter();
 v.writeStartDocument(true);
 v.writeElementString('test','Hello World');
 v.writeAttributeString('foo','bar');
 v.writeEndDocument();
 console.log( v.flush() );
}

that will produce

<?xml version="1.0" encoding="ISO-8859-1" standalone="true" ?>
 <test foo="bar">Hello World</test>
Community
  • 1
  • 1
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137