Groovy StreamingMarkupBuilder() producing non-XML

mmmxiv

New Member
I'm trying to figure out why in some cases StreamingMarkupBuilder() produces non-XML. Here's how I'm calling it:\[code\]public static void saveXMLToFile(def document, String file) { def xmlBuilder = new StreamingMarkupBuilder().bind { mkp.xmlDeclaration() mkp.yield document } new File(file).withWriter { out -> out << xmlBuilder }}\[/code\]And here's how we get there:\[code\]def document = new XmlParser(false, false).parse(manuscriptFile)if (document.name().equals("appendix")) { def newNode = new groovy.util.Node(null, "chapter", document.attributes(), document.value()) XMLUtils.saveXMLToFile(newNode, manuscriptFile)}\[/code\]But instead of getting out XML, I get:\[code\]<?xml version='1.0'?>title[attributes={id=_2140_5145_361}; value=http://stackoverflow.com/questions/10467829/[An introduction to blah]]partintro[attributes={id=_2140_5145_362}; value=[para[attributes={id=_2140_5145_363}; value=[My contents, blah blah blah]]]\[/code\]I've tried the docs, but unfortunately I'm not tremendously up on Groovy, so I'm sure I'm missing something simple. :(Thanks in advance...
 
Back
Top