OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SAX-ext proposal #2: Attribute isSpecified



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

PROPOSAL

    - 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:

 http://xml.org/sax/features/use-attributes2
   Read-only

   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).

QUESTIONS:

    - 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)