From: David Brownell <david-b@pa...> - 2001-08-02 01:05:45
Attributes infoset extensions [ sax-Feature Requests-446713 ]
- One of the infoset properties for attributes is not supported by
the current SAX2 API (including extensions): a flag saying if
a given attribute value was specified, or instead was defaulted.
- DOM expects this information, and building a DOM from a pure SAX2
parser means that it can't expose this information
- This is a slight modification of one from David Meggionson
(see the RFE above for more information)
- Define a new org.xml.sax.ext interface:
public interface Attributes2 extends Attributes
public boolean isSpecified (int index);
public boolean isSpecified (String uri, String localName);
public boolean isSpecified (String qName);
That would be implemented by Attributes objects provided in
startElement() callbacks, to expose this information.
- Define a new org.xml.sax.ext class implementing that
interface, inheriting from org.xml.sax.helpers.AttributesImpl
- Define a new standard feature ID:
If true, the Attributes object passed in startElement events
will also implement the Attributes2 interface, and can be
cast to it.
Note that because of the way Java typing works, testing that
feature would be optional: applications could always try to
cast (if they were willing to take the performance hit).
- Is there a better convention to use for extending interfaces
than the numeric suffix? (Meta-1)
- Is the new implementation class really needed? Alternative:
update AttributesImpl. (Meta-2)
Get latest updates about Open Source Projects, Conferences and News.