[jdom-interest] XMLOutputter format question

Jason Hunter jhunter at xquery.com
Wed Sep 29 15:34:12 PDT 2004


You can see some JDOM 1.0 examples in the "samples" directory with the 
distribution.

The answer to your question about Format is that you should call one of 
the getXXXFormat() methods and then tweak that instance rathern than 
calling the no-arg constructor directly.

I'm not entirely sure why the Format() constructor ended up private.  It 
was intended to be public but it doesn't matter much.

-jh-

da at vizbang.com wrote:

> hi jdom-i,
> 
> i was unable to locate a copy of the 2nd edition of "java & xml" at any of
> my local booksellers and i'm on too unfortunate of a schedule to wait for
> amazon, so i'm new on the list and hoping someone can help.
> 
> i'm debugging some rather sprawling chatbot code that was written to an
> earlier version of the jdom API.  actually, several earlier versions,
> apparently.  it's quite a mess.  rather than try to sort out which modules
> work with which versions, i'm trying to update the whole thing to 1.0.
> 
> overall, this is going well.  it's a nice API and pretty familiar
> territory, although my java fu is definitely weak and rusty.  the one
> problem i'm having is with some code that used to say this...
> 
>   outputter = new org.jdom.output.XMLOutputter("", false);
>   outputter.setTextNormalize(true);
>   outputter.setOmitDeclaration(true);
> 
> i tried rewriting it like this...
> 
>   org.jdom.output.Format f = new org.jdom.output.Format();
>   f.setTextMode(org.jdom.output.Format.TextMode.NORMALIZE);
>   f.setOmitDeclaration(true);
>   outputter = new org.jdom.output.XMLOutputter(f);
> 
> but i'm getting this error on that first line: "Format() has private
> access in org.jdom.output.Format." (hrunh?)  i've tried a number of
> variations on this that have yielded other errors.
> 
> it seems like all the examples i've been able to locate are written to
> earlier versions.  is there a secret cache of 1.0 examples around (other
> than, i presume, in the book)?  if not, can someone nudge me in the right
> direction?
> 
> thanks!
> 
> dan
> 
> da  -  dan  ancona
> you have the power
> http://vizbang.com
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 


More information about the jdom-interest mailing list