Name

The Attributes2 Interface

Synopsis

SAX 2.0.2 adds an Attributes2 subclass of Attributes that provides extra methods to determine whether a given attribute was declared in the DTD and/or specified in the instance document (as opposed to being defaulted in from the DTD). A parser that supports Attributes2 will pass an Attributes2 object to startElement( ) instead of a plain Attributes object. Using the extra methods requires a cast. Before casting, you may wish to check whether the cast will succeed by getting the value of the http://xml.org/sax/features/use-attributes2 feature. If this feature is true, the parser passes Attributes2 objects.

package org.xml.sax.ext;
     
public interface Attributes2 {
     
  public boolean isDeclared(int index);
  public boolean isDeclared(String qualifiedName);
  public boolean isSpecified(String  namespaceURI, String  localName);
  public boolean isSpecified(int index);
  public boolean isSpecified(String qualifiedName);
  public boolean isSpecified(String  namespaceURI, String  localName);
     
}

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.