1
// Attributes2.java - extended Attributes
2
// http://www.saxproject.org
3
// Public Domain: no warranty.
4
// $Id: Attributes2.java 226184 2005-04-08 10:53:24Z neeraj $
6
package org.xml.sax.ext;
8
import org.xml.sax.Attributes;
12
* SAX2 extension to augment the per-attribute information
13
* provided though {@link Attributes}.
14
* If an implementation supports this extension, the attributes
15
* provided in {@link org.xml.sax.ContentHandler#startElement
16
* ContentHandler.startElement() } will implement this interface,
17
* and the <em>http://xml.org/sax/features/use-attributes2</em>
18
* feature flag will have the value <em>true</em>.
21
* <em>This module, both source code and documentation, is in the
22
* Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
25
* <p> XMLReader implementations are not required to support this
26
* information, and it is not part of core-only SAX2 distributions.</p>
28
* <p>Note that if an attribute was defaulted (<em>!isSpecified()</em>)
29
* it will of necessity also have been declared (<em>isDeclared()</em>)
31
* Similarly if an attribute's type is anything except CDATA, then it
32
* must have been declared.
35
* @since SAX 2.0 (extensions 1.1 alpha)
36
* @author David Brownell
39
public interface Attributes2 extends Attributes
42
* Returns false unless the attribute was declared in the DTD.
43
* This helps distinguish two kinds of attributes that SAX reports
44
* as CDATA: ones that were declared (and hence are usually valid),
45
* and those that were not (and which are never valid).
47
* @param index The attribute index (zero-based).
48
* @return true if the attribute was declared in the DTD,
50
* @exception java.lang.ArrayIndexOutOfBoundsException When the
51
* supplied index does not identify an attribute.
53
public boolean isDeclared (int index);
56
* Returns false unless the attribute was declared in the DTD.
57
* This helps distinguish two kinds of attributes that SAX reports
58
* as CDATA: ones that were declared (and hence are usually valid),
59
* and those that were not (and which are never valid).
61
* @param qName The XML qualified (prefixed) name.
62
* @return true if the attribute was declared in the DTD,
64
* @exception java.lang.IllegalArgumentException When the
65
* supplied name does not identify an attribute.
67
public boolean isDeclared (String qName);
70
* Returns false unless the attribute was declared in the DTD.
71
* This helps distinguish two kinds of attributes that SAX reports
72
* as CDATA: ones that were declared (and hence are usually valid),
73
* and those that were not (and which are never valid).
75
* <p>Remember that since DTDs do not "understand" namespaces, the
76
* namespace URI associated with an attribute may not have come from
77
* the DTD. The declaration will have applied to the attribute's
80
* @param uri The Namespace URI, or the empty string if
81
* the name has no Namespace URI.
82
* @param localName The attribute's local name.
83
* @return true if the attribute was declared in the DTD,
85
* @exception java.lang.IllegalArgumentException When the
86
* supplied names do not identify an attribute.
88
public boolean isDeclared (String uri, String localName);
91
* Returns true unless the attribute value was provided
94
* @param index The attribute index (zero-based).
95
* @return true if the value was found in the XML text,
96
* false if the value was provided by DTD defaulting.
97
* @exception java.lang.ArrayIndexOutOfBoundsException When the
98
* supplied index does not identify an attribute.
100
public boolean isSpecified (int index);
103
* Returns true unless the attribute value was provided
106
* <p>Remember that since DTDs do not "understand" namespaces, the
107
* namespace URI associated with an attribute may not have come from
108
* the DTD. The declaration will have applied to the attribute's
111
* @param uri The Namespace URI, or the empty string if
112
* the name has no Namespace URI.
113
* @param localName The attribute's local name.
114
* @return true if the value was found in the XML text,
115
* false if the value was provided by DTD defaulting.
116
* @exception java.lang.IllegalArgumentException When the
117
* supplied names do not identify an attribute.
119
public boolean isSpecified (String uri, String localName);
122
* Returns true unless the attribute value was provided
125
* @param qName The XML qualified (prefixed) name.
126
* @return true if the value was found in the XML text,
127
* false if the value was provided by DTD defaulting.
128
* @exception java.lang.IllegalArgumentException When the
129
* supplied name does not identify an attribute.
131
public boolean isSpecified (String qName);