[jdom-interest] XMLOutputter/SAXBuilder

Gary Bentley gb at opengroup.org
Fri Sep 14 04:18:07 PDT 2001


BTW,

The workaround I've got at present is to take everything from the <wml> to 
</wml> and then prettify that since it can be represented as a JDOM element, 
however I have the added complication that I have to escape character 
entities, i..e modify all & with &amp;

Please lets get this sorted!

Gary

On Friday 14 September 2001 12:00, Bart Read wrote:
> You could try turning document validation off (I think you can do this) --
> I'm obviously assuming that you aren't going to need to validate the
> documents you're creating in your final system, but I could be mistaken. 
> My thinking is that if validation is turned off then the DTD won't be
> referred and so the default attributes won't be inserted (because the
> system doesn't know about them).
>
> Hope this helps.
>
> =================================
> Bart Read
> Senior Developer
> Abbotsbury Software Ltd
> Abbotsbury, DORSET DT3 4JT
> Tel: +44 (0) 1305 871644
> E-mail: bart at wdi.co.uk
> =================================
> ----- Original Message -----
> From: "Gary Bentley" <gb at opengroup.org>
> To: <jdom-interest at jdom.org>
> Sent: Friday, September 14, 2001 11:35 AM
> Subject: [jdom-interest] XMLOutputter/SAXBuilder
>
> > Right here's my problem folks,
> >
> > I am dynamically building a chunk of WML and then getting a combination
> > of SAXBuilder and XMLOutputter to format the string of WML for me.  This
>
> saves
>
> > me a lot of time and lets me not have to worry about the format of the
>
> intput
>
> > string.
> >
> > Now the problem:
> >
> > If I pass this chunk of WML to SAXBuilder and then XMLOutputter (via a
> > StringReader and StringWriter combination)
> >
> > <?xml version="1.0"?>
> > <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
> > "http://www.wapforum.org/DTD/wml13.dtd">
> > <wml>
> > <card newcontext="true" id="main">
> > <onevent type="onenterforward">
> > <go href="#card1"/>
> > </onevent>
> > </card>
> > </wml>
> >
> > Then what I actually get at the end of it is this:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
> > "http://www.wapforum.org/DTD/wml13.dtd">
> > <wml>
> >   <card newcontext="true" id="main" ordered="true">
> >     <onevent type="onenterforward">
> >       <go href="#card1" method="get" sendreferer="false"
> > enctype="application/x-www-form-urlencoded" />
> >
> >     </onevent>
> >
> > </card>
> > </wml>
> >
> > Now there are a few problems here, the main one (and I consider this
>
> either a
>
> > major bug or undocumented feature...take your pick) is that either
>
> SAXBuilder
>
> > (my current No 1 suspect and I haven't had chance to do a full
>
> investigation)
>
> > or XMLOutputter is adding in attributes to various elements, for example
>
> the
>
> > <card> element now has an "ordered" attribute that I certainly didn't ask
> > for, and the <go> element has the "sendreferer", "method" and "enctype"
> > attributes added.  It appears to be applying default attributes that are
> > specified in the DTD.  My suspicion is that one of the classes is
>
> examining
>
> > the DTD and being "clever", which is nice, but not the documented or
>
> required
>
> > behaviour.
> >
> > If this is a bug can it please be fixed, if it's not then can it please
> > be "switchable" so that I can turn it off, the application I am building
>
> needs
>
> > to be able to specify ALL the WML, not have it interpreted for me.
> >
> > A further problem is that there seems to be a newline added after the
> > <go> element and the end of the <onevent> element.  I know for there are
> > no newlines present in the string prior to conversion since I strip them
>
> with:
> > wml = wml.replace ('\n', ' ');
> >
> > And then use:
> >
> > XMLOutputter xout = new XMLOutputter ();
> >
> > xout.setIndent ("  ");
> > xout.setNewLines (true);
> > xout.setTextNormalize (true);
> >
> > Any ideas anyone...
> >
> > Cheers,
> >
> > Gary
> > _______________________________________________
> > To control your jdom-interest membership:
>
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
>s t.com
>
> > ---------- Automatically inserted by mailhost.wdi.co.uk ------------
> > This message has been scanned for virus, trojans, illegal relays and
> > spam. If you have any comments, problems or questions please do not
> > hesitate to contact:
> > Abbotsbury Software Ltd
> > Tel: +44 1305 871543 Fax: +44 1305 871688
> > Email: postmaster at wdi.co.uk
> > Web: http://www.wdi.co.uk/virus.phtml



More information about the jdom-interest mailing list