I am new with xlm files and I hope the solution is easy. I have built a file with xml-writer in node.js. How can I insert linebreak or indentation into the file ? Thanks
xw = new XMLWriter();
xw.startDocument("1.0", "UTF-8");
xw.startElement("1st element");
xw.writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
xw.writeAttribute(
"A",
"B"
);
xw.startElement("Lot");
xw.startElement("RAW");
xw.writeAttribute("E", F);
xw.endElement();
xw.endDocument()
CodePudding user response:
I'm not familiar with it, but the constructor for XMLWriter appears to have an "indent" parameter. Try new XmlWriter(true)
.