|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.apache.xerces.framework.XMLAttrList
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.
This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.
Constructor Summary | |
XMLAttrList(StringPool stringPool)
Constructor |
Method Summary | |
int |
addAttr(int attrName,
int attValue,
int attType,
boolean specified,
boolean search)
|
int |
addAttr(QName attribute,
int attValue,
int attType,
boolean specified,
boolean search)
Add an attribute to the current set. |
void |
endAttrList()
Terminate the current set of attributes. |
org.xml.sax.AttributeList |
getAttributeList(int attrListHandle)
Setup this instance to respond as an AttributeList implementation. |
int |
getAttrLocalpart(int attrIndex)
Return the localpart of the attribute. |
int |
getAttrName(int attrIndex)
Get the name of the attribute |
int |
getAttrPrefix(int attrIndex)
Get the prefix of the attribute. |
int |
getAttrURI(int attrIndex)
Return the uri of the attribute. |
int |
getAttType(int attrIndex)
Get the type of the attribute |
int |
getAttValue(int attrIndex)
Get the value of the attribute |
int |
getFirstAttr(int attrListHandle)
Get the first attribute in the attribute list. |
int |
getLength()
Return the number of attributes in this list. |
java.lang.String |
getLocalpart(int i)
Return the local part of an attribute in this list (by position). |
java.lang.String |
getName(int i)
Return the name of an attribute in this list (by position). |
int |
getNextAttr(int attrIndex)
Get the next attribute in the attribute list. |
java.lang.String |
getPrefix(int i)
Return the prefix of an attribute in this list (by position). |
java.lang.String |
getType(int i)
Return the type of an attribute in the list (by position). |
java.lang.String |
getType(java.lang.String name)
Return the type of an attribute in the list (by name). |
java.lang.String |
getURI(int i)
Returns the URI of an attribute in this list (by position). |
java.lang.String |
getValue(int i)
Return the value of an attribute in the list (by position). |
java.lang.String |
getValue(java.lang.String name)
Return the value of an attribute in the list (by name). |
boolean |
isSpecified(int attrIndex)
Was the attribute explicitly supplied or was it provided through a default? |
void |
releaseAttrList(int attrListHandle)
Make the resources of the current attribute list available for reuse. |
void |
reset(StringPool stringPool)
Reset this instance to an "empty" state. |
void |
setAttrURI(int attrIndex,
int uri)
Sets the uri of the attribute. |
void |
setAttType(int attrIndex,
int attTypeIndex)
Sets the type of the attribute. |
int |
startAttrList()
Start a new set of attributes. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public XMLAttrList(StringPool stringPool)
stringPool
- The string pool instance to use.Method Detail |
public void reset(StringPool stringPool)
stringPool
- The string pool instance to use.public int addAttr(int attrName, int attValue, int attType, boolean specified, boolean search) throws java.lang.Exception
public int addAttr(QName attribute, int attValue, int attType, boolean specified, boolean search) throws java.lang.Exception
attrName
- The name of the attribute, an index in the string pool.attValue
- The value of the attribute, an index in the string pool.attType
- The type of the attribute, an index in the string pool.specified
- true
if the attribute is specified directly; otherwise
false
is the attribute is provided through a default.search
- true
if the list should be searched for a duplicate.search
was true
and attrName
was already present.public int startAttrList()
public void endAttrList()
public int getAttrPrefix(int attrIndex)
public int getAttrLocalpart(int attrIndex)
public int getAttrName(int attrIndex)
attrIndex
- The index of the attribute.public void setAttrURI(int attrIndex, int uri)
public int getAttrURI(int attrIndex)
public int getAttValue(int attrIndex)
attrIndex
- The index of the attribute.public void setAttType(int attrIndex, int attTypeIndex)
public int getAttType(int attrIndex)
attrIndex
- The index of the attribute.public boolean isSpecified(int attrIndex)
attrIndex
- The index of the attribute.true
if the attribute was specified directly; otherwise
false
is the attribute was provided through a default.public void releaseAttrList(int attrListHandle)
The
- attribute list handle.public int getFirstAttr(int attrListHandle)
attrListHandle
- The attribute list handle.public int getNextAttr(int attrIndex)
attrIndex
- The attribute index.attrIndex
in
the same attribute list or -1 if there is no next index.public org.xml.sax.AttributeList getAttributeList(int attrListHandle)
AttributeList
implementation.
AttributeList
.public int getLength()
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.
public java.lang.String getPrefix(int i)
public java.lang.String getLocalpart(int i)
public java.lang.String getName(int i)
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.
i
- The index of the attribute in the list (starting at 0).getLength()
public java.lang.String getURI(int i)
public java.lang.String getType(int i)
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".
i
- The index of the attribute in the list (starting at 0).getLength()
,
getType(java.lang.String)
public java.lang.String getValue(int i)
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.
i
- The index of the attribute in the list (starting at 0).getLength()
,
getValue(java.lang.String)
public java.lang.String getType(java.lang.String 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.
name
- The name of the attribute.getType(int)
public java.lang.String getValue(java.lang.String 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.
i
- The index of the attribute in the list.getValue(int)
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs60 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |