My question is this : How can I get XML writer to write the xml header
<?xml version="1.0" encoding="utf-8"?>
I have an set of Elements i.e. < tag1></tag1><tag2></tag2> etc etc.
which has been generated from using XMLParser reading an xml file.
- This gives <ROOT> <tags .... /tags>.
After updateing the elements and values I now want to write the xml back to a file or a string.
Element myElements ; // Already propogated element
XMLWriter xmlWriter = new XMLWriter(false);
StringWriter stringWriter = new StringWriter();
xmlWriter.writeXML(stringWriter,myElements);
Do i need to create and Element "?XML" with the correct set attributes?
- but this means a tag <?xml> </?xml> which breaks xml headers
Or do I have to add the headerr string manually before using XMLwriter?
any ideas?