[jdom-interest] XMLOutputter/SAXBuilder

philip.nelson at omniresources.com philip.nelson at omniresources.com
Fri Sep 14 16:54:02 PDT 2001

> It's actually not JDOM at all. SAX reports default attributes 
> on an element,
> and does not give any indication that these attributes /are/ 
> default. In
> other words, it's a "bug/feature" of SAX 2.0 itself. I don't 
> know of anyway
> to turn that processing off, and since SAX doesn't yet provide any
> additional typing or related information about default vs. declared
> attributes, I'm not sure how we could take care of it if we wanted to.

This is close to what Elliotte wanted for his XInclude processor.  I think
it would be possible when setExpandEntities is false and the DTDHandler is
active.  Elliottes idea was some sort of AttributeType class that could be
obtained from the attribute itself.  A model would be kept in the Doctype.
The idea stalled when someone brought up schemas which can do similar and
vastly expanded sorts of things.  Is there a common model?  I am not sure
that schemas and dtds have enough in common to model them the same way.  For
example, the terminology seems so very different.  A schema model would have
so many dead parts if derived from a dtd, etc., etc..   Notations and
unparsed entities were something Elliotte really needed.

Of course, somebody would have to volunteer to do this...

> If you've got any ideas, I'm certainly all ears! However, I 
> will point out
> that the DTD specifying these as default attributes 
> (actually, IMPLIED),
> means that your application should /not/ choke on them, 
> because they are
> essentially "on" the element anyway. So you may have a bigger 
> problem, such
> as with WML documents that someone else creates.
> > 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);
> Alex Chaffee is our XMLOutputter superhero, so maybe he will 
> comment here.
> Alex, any ideas?
> Thanks
> -- 
> Brett Mclaughlin       <http://www.newInstance.com>
> Lutris Technologies    <http://www.lutris.com>
> Author, "Java and XML" <http://www.oreilly.com/catalog/javaxml2>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com

More information about the jdom-interest mailing list