Java Forums - Java 1.5 doesn't want to indent XML output?: "Re: Java 1.5 doesn't want to indent XML output?
Author: js Oct 20, 2004 2:40 PM (reply 2 of 16)
I got bit by this one too. After spending quite a while poring through the Java source, here's a solution:
TransformFactory factory = TransformerFactory.newInstance();
factory.setAttribute('indent-number', new Integer(4));
This works with Java 1.5 but (sigh) the setAttribute() call causes an IllegalArgumentException in 1.4. So wrap the setAttribute() in a try/catch and throw away the IllegalArgumentException..."
Friday, April 29, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment