FileDocCategorySizeDatePackage
XMLAttributes.javaAPI DocJava SE 5 API15025Fri Aug 26 14:55:56 BST 2005com.sun.org.apache.xerces.internal.xni

XMLAttributes

public interface XMLAttributes
The XMLAttributes interface defines a collection of attributes for an element. In the parser, the document source would scan the entire start element and collect the attributes. The attributes are communicated to the document handler in the startElement method.

The attributes are read-write so that subsequent stages in the document pipeline can modify the values or change the attributes that are propogated to the next stage.

see
XMLDocumentHandler#startElement
author
Andy Clark, IBM
version
$Id: XMLAttributes.java,v 1.9 2003/01/23 17:27:12 sandygao Exp $

Fields Summary
Constructors Summary
Methods Summary
public intaddAttribute(com.sun.org.apache.xerces.internal.xni.QName attrName, java.lang.String attrType, java.lang.String attrValue)
Adds an attribute. The attribute's non-normalized value of the attribute will have the same value as the attribute value until set using the setNonNormalizedValue method. Also, the added attribute will be marked as specified in the XML instance document unless set otherwise using the setSpecified method.

Note: If an attribute of the same name already exists, the old values for the attribute are replaced by the new values.

param
attrName The attribute name.
param
attrType The attribute type. The type name is determined by the type specified for this attribute in the DTD. For example: "CDATA", "ID", "NMTOKEN", etc. However, attributes of type enumeration will have the type value specified as the pipe ('|') separated list of the enumeration values prefixed by an open parenthesis and suffixed by a close parenthesis. For example: "(true|false)".
param
attrValue The attribute value.
return
Returns the attribute index.
see
#setNonNormalizedValue
see
#setSpecified

public com.sun.org.apache.xerces.internal.xni.AugmentationsgetAugmentations(int attributeIndex)
Look up an augmentation by attribute's index.

param
attributeIndex The attribute index.
return
Augmentations

public com.sun.org.apache.xerces.internal.xni.AugmentationsgetAugmentations(java.lang.String uri, java.lang.String localPart)
Look up an augmentation by namespace name.

param
uri The Namespace URI, or the empty string if the name has no Namespace URI.
param
localPart
return
Augmentations

public com.sun.org.apache.xerces.internal.xni.AugmentationsgetAugmentations(java.lang.String qName)
Look up an augmentation by XML 1.0 qualified name.

param
qName The XML 1.0 qualified name.
return
Augmentations

public intgetIndex(java.lang.String qName)
Look up the index of an attribute by XML 1.0 qualified name.

param
qName The qualified (prefixed) name.
return
The index of the attribute, or -1 if it does not appear in the list.

public intgetIndex(java.lang.String uri, java.lang.String localPart)
Look up the index of an attribute by Namespace name.

param
uri The Namespace URI, or the empty string if the name has no Namespace URI.
param
localName The attribute's local name.
return
The index of the attribute, or -1 if it does not appear in the list.

public intgetLength()
Returns the number of attributes in the list.

Once you know the number of attributes, you can iterate through the list.

see
#getURI(int)
see
#getLocalName(int)
see
#getQName(int)
see
#getType(int)
see
#getValue(int)

public java.lang.StringgetLocalName(int index)
Look up an attribute's local name by index.

param
index The attribute index (zero-based).
return
The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.
see
#getLength

public voidgetName(int attrIndex, com.sun.org.apache.xerces.internal.xni.QName attrName)
Sets the fields in the given QName structure with the values of the attribute name at the specified index.

param
attrIndex The attribute index.
param
attrName The attribute name structure to fill in.

public java.lang.StringgetNonNormalizedValue(int attrIndex)
Returns the non-normalized value of the attribute at the specified index. If no non-normalized value is set, this method will return the same value as the getValue(int) method.

param
attrIndex The attribute index.

public java.lang.StringgetPrefix(int index)
Returns the prefix of the attribute at the specified index.

param
index The index of the attribute.

public java.lang.StringgetQName(int index)
Look up an attribute's XML 1.0 qualified name by index.

param
index The attribute index (zero-based).
return
The XML 1.0 qualified name, or the empty string if none is available, or null if the index is out of range.
see
#getLength

public java.lang.StringgetType(int index)
Look up an attribute's type by index.

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

param
index The attribute index (zero-based).
return
The attribute's type as a string, or null if the index is out of range.
see
#getLength

public java.lang.StringgetType(java.lang.String qName)
Look up an attribute's type by XML 1.0 qualified name.

See {@link #getType(int) getType(int)} for a description of the possible types.

param
qName The XML 1.0 qualified name.
return
The attribute type as a string, or null if the attribute is not in the list or if qualified names are not available.

public java.lang.StringgetType(java.lang.String uri, java.lang.String localName)
Look up an attribute's type by Namespace name.

See {@link #getType(int) getType(int)} for a description of the possible types.

param
uri The Namespace URI, or the empty String if the name has no Namespace URI.
param
localName The local name of the attribute.
return
The attribute type as a string, or null if the attribute is not in the list or if Namespace processing is not being performed.

public java.lang.StringgetURI(int index)
Look up an attribute's Namespace URI by index.

param
index The attribute index (zero-based).
return
The Namespace URI, or the empty string if none is available, or null if the index is out of range.
see
#getLength

public java.lang.StringgetValue(int index)
Look up an attribute's value by index.

If the attribute value is a list of tokens (IDREFS, ENTITIES, or NMTOKENS), the tokens will be concatenated into a single string with each token separated by a single space.

param
index The attribute index (zero-based).
return
The attribute's value as a string, or null if the index is out of range.
see
#getLength

public java.lang.StringgetValue(java.lang.String qName)
Look up an attribute's value by XML 1.0 qualified name.

See {@link #getValue(int) getValue(int)} for a description of the possible values.

param
qName The XML 1.0 qualified name.
return
The attribute value as a string, or null if the attribute is not in the list or if qualified names are not available.

public java.lang.StringgetValue(java.lang.String uri, java.lang.String localName)
Look up an attribute's value by Namespace name.

See {@link #getValue(int) getValue(int)} for a description of the possible values.

param
uri The Namespace URI, or the empty String if the name has no Namespace URI.
param
localName The local name of the attribute.
return
The attribute value as a string, or null if the attribute is not in the list.

public booleanisSpecified(int attrIndex)
Returns true if the attribute is specified in the instance document.

param
attrIndex The attribute index.

public voidremoveAllAttributes()
Removes all of the attributes. This method will also remove all entities associated to the attributes.

public voidremoveAttributeAt(int attrIndex)
Removes the attribute at the specified index.

Note: This operation changes the indexes of all attributes following the attribute at the specified index.

param
attrIndex The attribute index.

public voidsetAugmentations(int attrIndex, com.sun.org.apache.xerces.internal.xni.Augmentations augs)
Sets the augmentations of the attribute at the specified index.

param
attrIndex The attribute index.
param
augs The augmentations.

public voidsetName(int attrIndex, com.sun.org.apache.xerces.internal.xni.QName attrName)
Sets the name of the attribute at the specified index.

param
attrIndex The attribute index.
param
attrName The new attribute name.

public voidsetNonNormalizedValue(int attrIndex, java.lang.String attrValue)
Sets the non-normalized value of the attribute at the specified index.

param
attrIndex The attribute index.
param
attrValue The new non-normalized attribute value.

public voidsetSpecified(int attrIndex, boolean specified)
Sets whether an attribute is specified in the instance document or not.

param
attrIndex The attribute index.
param
specified True if the attribute is specified in the instance document.

public voidsetType(int attrIndex, java.lang.String attrType)
Sets the type of the attribute at the specified index.

param
attrIndex The attribute index.
param
attrType The attribute type. The type name is determined by the type specified for this attribute in the DTD. For example: "CDATA", "ID", "NMTOKEN", etc. However, attributes of type enumeration will have the type value specified as the pipe ('|') separated list of the enumeration values prefixed by an open parenthesis and suffixed by a close parenthesis. For example: "(true|false)".

public voidsetValue(int attrIndex, java.lang.String attrValue)
Sets the value of the attribute at the specified index. This method will overwrite the non-normalized value of the attribute.

param
attrIndex The attribute index.
param
attrValue The new attribute value.
see
#setNonNormalizedValue