[jdom-interest] Attribute types

Jason Hunter jhunter at acm.org
Fri Sep 7 15:37:52 PDT 2001


How is this feature necessary for implementing XPath, XPointer, XSLT --
yet still not present in DOM which supports those technologies?

-jh-

Elliotte Rusty Harold wrote:
> 
> I think the Attribute class should have a getType() method which returns the type of the attribute, CDATA by default; NMTOKEN, NMTOKENS, ID, etc. if the DTD says otherwise and the parser is reading the DTD. Among other applications this is necessary for implementing XPath/XPointer/XSLT which all need access to ID type attributes and for XInclude which needs access to attributed declared to be unparsed entity or notation.
> 
> We could return this as a String; e.g.:
> 
> public String getType()
> 
> or as an instance of an enumerated AttributeType class.
> 
> Changes to attribute would be minor (one new immutable field, one new method, and probably one additional constructor). Changes to XMLOutputter would be non existent. Most of the work to support this would have to go into SAXBuilder.
> 
> Note that this cannot be supported in DOMBuilder because DOM does not expose this information. Additional plus is this lets JDOM do something the DOM can't.
> 
> Thoughts? Commments? Is there any significant downside to adding this?
> --
> 
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
> |              http://www.ibiblio.org/xml/books/bible2/              |
> |   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
> |  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
> +----------------------------------+---------------------------------+
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com





More information about the jdom-interest mailing list