Link to home
Start Free TrialLog in
Avatar of defa0009
defa0009

asked on

XML Pretty Printing...

I am trying to set the indenting of an xml doc so it is easily readable but it is not working?

I would like to stick with the javax.xml.transform classes...

Here is the code I am using


      private void indentXML(Document doc){

            try{
                  Transformer trans = TransformerFactory.newInstance().newTransformer();
                  trans.setOutputProperty(OutputKeys.INDENT, "yes");
                  trans.transform(new DOMSource(doc), new StreamResult(System.out));

            }catch(Exception e){}
      }
ASKER CERTIFIED SOLUTION
Avatar of hoomanv
hoomanv
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of defa0009
defa0009

ASKER

Your the man!