[jdom-interest] Jdom - XMLOutputter problem

Jason Hunter jhunter at servlets.com
Tue Sep 30 12:28:47 PDT 2008


The formatting is now specified on a Format class instead of directly  
on the XMLOutputter.

 From memory:
new XMLOutputter(Format.getPrettyFormat())

-jh-

On Sep 30, 2008, at 9:46 AM, perez wrote:

>
> Hi,
>
> I want to output xml with JDOM using XMLOutputter class. I would  
> like to use
> some of his methods to improve the results in the file. I have  
> downloaded
> the last jdom api (1.1) and in my program, the code doesn't recognize
> several methods of that class. In the example above the program  
> doesn't
> recognize        xmlOutputter.setTextTrim( true );
> xmlOutputter.setIndent( 2 );
> xmlOutputter.setNewlines( true );
>
> Can you explain me why is this happen? How can I fix this problem
>
> Thanx
> MP
>
>
>
> import org.jdom.Document;
> 	import org.jdom.input.SAXBuilder;
> 	import org.jdom.output.XMLOutputter;
>
> 	public class Teste {
> 	  public static void main( String[] args ) {
> 	    try {
> 	      // use SAXBuilder to create DOM from numerous types of input
> 	      SAXBuilder builder = new SAXBuilder();
> 	      builder.setExpandEntities( true );
> 	      Document doc = builder.build( "drainpipe.xml" );
>
> 	      // create and configure the XMLOutputter
> 	      XMLOutputter xmlOutputter = new XMLOutputter();
> 	      xmlOutputter.setTextTrim( true );
> 	      xmlOutputter.setIndent( 2 );
> 	      xmlOutputter.setNewlines( true );
>
> 	      // output the text
> 	      xmlOutputter.output( doc, System.out );
> 	    }
> 	    catch( Exception ioe ) {
> 	      ioe.printStackTrace();
> 	    }
> 	  }
> 	}
>
> -- 
> View this message in context: http://www.nabble.com/Jdom---XMLOutputter-problem-tp19746001p19746001.html
> Sent from the JDOM - General mailing list archive at Nabble.com.
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/ 
> youraddr at yourhost.com



More information about the jdom-interest mailing list