Believe it or not: it's not easy. See for example:
http://raz.cx/blog/2005/12/java-xml-and-pretty-printing.html
for a quick overview of this mess. IOW the official API does not support
it, while the underlying implementation does - but you would have to use a
hardcoded/private class that may or may not be where you expect it in the
next JDK. :-(
We would have to add either an optional XSLT pass for pretty-printing with
a "default" stylesheet (can there be such a thing? no idea) or pipe the
transformed document through another pretty-printer. Maybe you could come
up with an XMLPrettyPrinterTransformer :)
Needless to say, I'm somewhat sceptical that this is such an important
feature - contrary to popular belief XML is meant to be read by machines,
not humans..
-h
---------------------------------------------------------------------
To unsubscribe from this list please visit:
Other then that, I have to agree with Holger that XML is meant to be used by machines and that a better tool then Mule could be used for actually editing them.
------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match ="/" >
<xsl:copy-of select="/" />
</xsl:template>
</xsl:stylesheet>
-------------
Hope that helps.
Curtis Boyden
Have you tried the <xsl:output/> element with the indent="yes" parameter? My test did not yield indentation, but it did break it into lines. My main solution, if I am just spot checking the XML, is to open it with a browser, they automatically Pretty Print it for you.
Very nice! That would be a welcome addition to the code, especially since
dom4j is already in the list of xml module dependencies. Can you try to
add that to the XsltTransformer or write a new PrettyPrinter and attach it
to a JIRA?
This has come up in the past so I guess it would be useful for others as well.
Holger
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
When trying to start the Config visualizer via shell on linux?
I have my mule installation @my home dir and looks like this:
/home/cescobar/Mule
I have it linked to /opt/mule and added the latter to my PATH and
MULE_HOME, I also did a symlink to the same directory called mule_base,
but didn't add that var.
The error happened after I typed:
cescobar@oceano:~/Mule/bin$ ./visualizer
The complete StackTrace:
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:122)
at
org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:160)
I checked the jars @ $MULE_HOME/lib/opt and all the ones asked by the
script are there.. I even chmod'ed them 755 (from 644) but nothing
happened :(
It's not necessary for my project but I thought it'd be useful to avoid
writing the config by "hand" =P
Does anybody get a:
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
When trying to start the Config visualizer via shell on linux?
I have my mule installation @my home dir and looks like this:
/home/cescobar/Mule
I have it linked to /opt/mule and added the latter to my PATH and
MULE_HOME, I also did a symlink to the same directory called mule_base,
but didn't add that var.
The error happened after I typed:
cescobar@oceano:~/Mule/bin$ ./visualizer
The complete StackTrace:
java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at
org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:122)
at
org.codehaus.groovy.tools.GroovyStarter.main (GroovyStarter.java:160)