Libxml Output Tidiness
BlitzMax Forums/Brucey's Modules/Libxml Output Tidiness
| ||
Hi is it possible to change the way Libxml formats its output? It kind of spews everything out without any whitespace, and this is very hard for a human to read, and it's made a right mess of my previously perfectly indented documents! This might seem pedantic, but we chose XML as it's human-readable and the program was intended to be a supplement to direct XML editing and not a direct replacement. (Well it would be nice but until it's finished somebody's got to edit the XML files too, and poor him, he was most upset by the XML files I gave him!!!) See if you can spot which parts of the file were added by the program ;) Edit: lack of wordwrap hides the mounds of text! |
| ||
There's a method called saveFormatFile() which takes a "format" parameter. Setting that to True should make it prettier :-) A little demonstration : SuperStrict Framework BaH.Libxml Import brl.standardio ' Create a new document Local doc:TxmlDoc = TxmlDoc.newDoc("1.0") If doc Then Print "~n~n" Local node:TxmlNode = TxmlNode.newNode("box") doc.setRootElement(node) node.addChild("x", Null, "10") node.addChild("y", Null, "10") node.addChild("width", Null, "25") node.addChild("height", Null, "25") ' output the document to stdout doc.saveFile("-") Print "~n~n" doc.saveFormatFile("-", True) End If There's also a ToStringFormat() too, if you want to write formatted data directly to a string. |