| java.lang.Object org.apache.xerces.framework.XMLAttrList
XMLAttrList | final public class XMLAttrList implements AttributeList(Code) | | An instance of this class is used to represent the set of attributes
for an element that are either directly specified or provided through
a default value in the grammar for the document. XMLAttrList carries
the attributes associated with an element from the scanner up to the
application level (via the SAX AtributeList). Because all the attributes
are bundled up together before being presented to the application, we don't
have a way to build up an attribute value from pieces, most notably entity
references.
There is typically one instance of this class for each instance of a
parser. The parser may either use this object to hold the attributes
of a single element, calling releaseAttrList() before each new element,
or it may use this object to hold the attributes of all of the elements
in the document.
To start saving a new set of attributes, the startAttrList() method is
called, returning a handle for the attribute list. All addAttr() calls
will be added to the set until a call is made to endAttrList(). A handle
of -1 is used to indicate that there are no attributes in the set.
When an attribute is added to the set, the type of the attribute and an
indicator of whether it was specified explicitly or through a default is
provided.
The attributes in the set may be accessed either through the getFirstAttr()
and getNextAttr() iteration interface, or the getAttributeList() method
may be used to access the attribute list through the SAX AttributeList
interface.
version: $Id: XMLAttrList.java,v 1.10 2001/07/20 17:26:10 lmartin Exp $ |
Method Summary | |
public int | addAttr(int attrName, int attValue, int attType, boolean specified, boolean search) | public int | addAttr(QName attribute, int attValue, int attType, boolean specified, boolean search) Add an attribute to the current set.
Parameters: attrName - The name of the attribute, an index in the string pool. Parameters: attValue - The value of the attribute, an index in the string pool. Parameters: attType - The type of the attribute, an index in the string pool. Parameters: specified - true if the attribute is specified directly; otherwisefalse is the attribute is provided through a default. Parameters: search - true if the list should be searched for a duplicate. | public int[] | endAttrList() Terminate the current set of attributes. | public int | getAttType(int attrIndex) Get the type of the attribute
Parameters: attrIndex - The index of the attribute. | public int | getAttValue(int attrIndex) Get the value of the attribute
Parameters: attrIndex - The index of the attribute. | public int | getAttrLocalpart(int attrIndex) Return the localpart of the attribute. | public int | getAttrName(int attrIndex) Get the name of the attribute
Parameters: attrIndex - The index of the attribute. | public int | getAttrPrefix(int attrIndex) Get the prefix of the attribute. | public int | getAttrURI(int attrIndex) Return the uri of the attribute. | public AttributeList | getAttributeList(int attrListHandle) Setup this instance to respond as an AttributeList implementation. | public int | getFirstAttr(int attrListHandle) Get the first attribute in the attribute list.
Parameters: attrListHandle - The attribute list handle. | public int | getLength() Return the number of attributes in this list.
The SAX parser may provide attributes in any
arbitrary order, regardless of the order in which they were
declared or specified. | public String | getLocalpart(int i) Return the local part of an attribute in this list (by position). | public String | getName(int i) Return the name of an attribute in this list (by position).
The names must be unique: the SAX parser shall not include the
same attribute twice. | public int | getNextAttr(int attrIndex) Get the next attribute in the attribute list.
Parameters: attrIndex - The attribute index. | public String | getPrefix(int i) Return the prefix of an attribute in this list (by position). | public String | getType(int i) Return the type of an attribute in the list (by position).
The attribute type is one of the strings "CDATA", "ID",
"IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute,
or if the parser does not report attribute types, then it must
return the value "CDATA" as stated in the XML 1.0 Recommentation
(clause 3.3.3, "Attribute-Value Normalization").
For an enumerated attribute that is not a notation, the
parser will report the type as "NMTOKEN".
Parameters: i - The index of the attribute in the list (starting at 0). | public String | getType(String name) Return the type of an attribute in the list (by name).
The return value is the same as the return value for
getType(int).
If the attribute name has a namespace prefix in the document,
the application must include the prefix here.
Parameters: name - The name of the attribute. | public String | getURI(int i) Returns the URI of an attribute in this list (by position). | public String | getValue(int i) Return the value of an attribute in the list (by position).
If the attribute value is a list of tokens (IDREFS,
ENTITIES, or NMTOKENS), the tokens will be concatenated
into a single string separated by whitespace.
Parameters: i - The index of the attribute in the list (starting at 0). | public String | getValue(String name) Return the value of an attribute in the list (by name).
The return value is the same as the return value for
getValue(int).
If the attribute name has a namespace prefix in the document,
the application must include the prefix here.
Parameters: i - The index of the attribute in the list. | public boolean | isSpecified(int attrIndex) Was the attribute explicitly supplied or was it provided through a default?
Parameters: attrIndex - The index of the attribute. | public void | releaseAttrList(int attrListHandle) Make the resources of the current attribute list available for reuse. | public void | reset(StringPool stringPool) Reset this instance to an "empty" state. | public void | setAttType(int attrIndex, int attTypeIndex) Sets the type of the attribute. | public void | setAttValue(int attrIndex, int attrValue) Sets the value of the attribute. | public void | setAttrURI(int attrIndex, int uri) Sets the uri of the attribute. | public int | startAttrList() Start a new set of attributes. |
XMLAttrList | public XMLAttrList(StringPool stringPool)(Code) | | Constructor
Parameters: stringPool - The string pool instance to use. |
addAttr | public int addAttr(int attrName, int attValue, int attType, boolean specified, boolean search) throws Exception(Code) | | |
addAttr | public int addAttr(QName attribute, int attValue, int attType, boolean specified, boolean search) throws Exception(Code) | | Add an attribute to the current set.
Parameters: attrName - The name of the attribute, an index in the string pool. Parameters: attValue - The value of the attribute, an index in the string pool. Parameters: attType - The type of the attribute, an index in the string pool. Parameters: specified - true if the attribute is specified directly; otherwisefalse is the attribute is provided through a default. Parameters: search - true if the list should be searched for a duplicate. The index of this attribute; or -1 is search was true and attrName was already present. |
endAttrList | public int[] endAttrList()(Code) | | Terminate the current set of attributes.
|
getAttType | public int getAttType(int attrIndex)(Code) | | Get the type of the attribute
Parameters: attrIndex - The index of the attribute. The type of the attribute, an index in the string pool. |
getAttValue | public int getAttValue(int attrIndex)(Code) | | Get the value of the attribute
Parameters: attrIndex - The index of the attribute. The value of the attribute, an index in the string pool. |
getAttrLocalpart | public int getAttrLocalpart(int attrIndex)(Code) | | Return the localpart of the attribute.
|
getAttrName | public int getAttrName(int attrIndex)(Code) | | Get the name of the attribute
Parameters: attrIndex - The index of the attribute. The name of the attribute, an index in the string pool. |
getAttrPrefix | public int getAttrPrefix(int attrIndex)(Code) | | Get the prefix of the attribute.
|
getAttrURI | public int getAttrURI(int attrIndex)(Code) | | Return the uri of the attribute.
|
getAttributeList | public AttributeList getAttributeList(int attrListHandle)(Code) | | Setup this instance to respond as an AttributeList implementation.
This instance as an AttributeList . |
getFirstAttr | public int getFirstAttr(int attrListHandle)(Code) | | Get the first attribute in the attribute list.
Parameters: attrListHandle - The attribute list handle. The index of the first attribute in the specifiedattribute list or -1 if the handle is invalid. |
getLength | public int getLength()(Code) | | Return the number of attributes in this list.
The SAX parser may provide attributes in any
arbitrary order, regardless of the order in which they were
declared or specified. The number of attributes may be
zero.
The number of attributes in the list. |
getLocalpart | public String getLocalpart(int i)(Code) | | Return the local part of an attribute in this list (by position).
|
getName | public String getName(int i)(Code) | | Return the name of an attribute in this list (by position).
The names must be unique: the SAX parser shall not include the
same attribute twice. Attributes without values (those declared
#IMPLIED without a value specified in the start tag) will be
omitted from the list.
If the attribute name has a namespace prefix, the prefix
will still be attached.
Parameters: i - The index of the attribute in the list (starting at 0). The name of the indexed attribute, or nullif the index is out of range. See Also: XMLAttrList.getLength |
getNextAttr | public int getNextAttr(int attrIndex)(Code) | | Get the next attribute in the attribute list.
Parameters: attrIndex - The attribute index. The index of the next attribute after attrIndex inthe same attribute list or -1 if there is no next index. |
getPrefix | public String getPrefix(int i)(Code) | | Return the prefix of an attribute in this list (by position).
|
getType | public String getType(int i)(Code) | | Return the type of an attribute in the list (by position).
The attribute type is one of the strings "CDATA", "ID",
"IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
or "NOTATION" (always in upper case).
If the parser has not read a declaration for the attribute,
or if the parser does not report attribute types, then it must
return the value "CDATA" as stated in the XML 1.0 Recommentation
(clause 3.3.3, "Attribute-Value Normalization").
For an enumerated attribute that is not a notation, the
parser will report the type as "NMTOKEN".
Parameters: i - The index of the attribute in the list (starting at 0). The attribute type as a string, ornull if the index is out of range. See Also: XMLAttrList.getLength See Also: XMLAttrList.getType(java.lang.String) |
getType | public String getType(String name)(Code) | | Return the type of an attribute in the list (by name).
The return value is the same as the return value for
getType(int).
If the attribute name has a namespace prefix in the document,
the application must include the prefix here.
Parameters: name - The name of the attribute. The attribute type as a string, or null if nosuch attribute exists. See Also: XMLAttrList.getType(int) |
getURI | public String getURI(int i)(Code) | | Returns the URI of an attribute in this list (by position).
|
getValue | public String getValue(int i)(Code) | | Return the value of an attribute in the list (by position).
If the attribute value is a list of tokens (IDREFS,
ENTITIES, or NMTOKENS), the tokens will be concatenated
into a single string separated by whitespace.
Parameters: i - The index of the attribute in the list (starting at 0). The attribute value as a string, ornull if the index is out of range. See Also: XMLAttrList.getLength See Also: XMLAttrList.getValue(java.lang.String) |
getValue | public String getValue(String name)(Code) | | Return the value of an attribute in the list (by name).
The return value is the same as the return value for
getValue(int).
If the attribute name has a namespace prefix in the document,
the application must include the prefix here.
Parameters: i - The index of the attribute in the list. The attribute value as a string, or null ifno such attribute exists. See Also: XMLAttrList.getValue(int) |
isSpecified | public boolean isSpecified(int attrIndex)(Code) | | Was the attribute explicitly supplied or was it provided through a default?
Parameters: attrIndex - The index of the attribute. true if the attribute was specified directly; otherwisefalse is the attribute was provided through a default. |
releaseAttrList | public void releaseAttrList(int attrListHandle)(Code) | | Make the resources of the current attribute list available for reuse.
Parameters: The - attribute list handle. |
reset | public void reset(StringPool stringPool)(Code) | | Reset this instance to an "empty" state.
Parameters: stringPool - The string pool instance to use. |
setAttType | public void setAttType(int attrIndex, int attTypeIndex)(Code) | | Sets the type of the attribute.
|
setAttValue | public void setAttValue(int attrIndex, int attrValue)(Code) | | Sets the value of the attribute.
|
setAttrURI | public void setAttrURI(int attrIndex, int uri)(Code) | | Sets the uri of the attribute.
|
startAttrList | public int startAttrList()(Code) | | Start a new set of attributes.
The handle for the new set of attributes. |
|
|