On Tue, May 17, 2011 at 11:15 AM, ant elder <ant.el...@gmail.com> wrote:
> > > On Tue, May 17, 2011 at 11:05 AM, Simon Nash <n...@apache.org> wrote: > >> ant elder wrote: >> >>> Does anyone know how to get XML from the Tuscany model objects thats >>> nicely formatted? >>> >>> As a quick hack I came up with this but it seems like theres probably >>> something better and I'm not sure that org.apache.xml.serialize.OutputFormat >>> and org.apache.xml.serialize.XMLSerializer are going to be there by default >>> in all runtimes: >>> >>> I did something very similar in >> org.apache.tuscany.sca.itest.builder.TestUtils > > > Ok thanks for the pointed, looks just the same. I'm not sure if we should > use those org.apache.xml.serialize classes though in 2.x as i don't want to > require a dependency on xerces. They are there in the JDK i'm using, guess i > need to research if they're there on other JDKs too. > > ...ant > > It sounds like in JDK6 org.w3c.dom.ls.LSSerializer should be used, i've added some code to try that here: https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Utils.java It still doesn't seem perfect code, and it doesn't seem great to have to serialize to an xml string then read into a Document then serialize back to formatted xml string. ...ant