BEA Systems, Inc.

WebLogic Server 6.1 API Reference

weblogic.apache.xalan.stree
Class ElementImpl

java.lang.Object
  |
  +--weblogic.apache.xml.utils.UnImplNode
        |
        +--weblogic.apache.xalan.stree.Child
              |
              +--weblogic.apache.xalan.stree.Parent
                    |
                    +--weblogic.apache.xalan.stree.ElementImpl
Direct Known Subclasses:
ElementImplWithNS

public class ElementImpl
extends Parent
implements org.xml.sax.Attributes, org.w3c.dom.NamedNodeMap

This class represents an element in an HTML or XML document. Elements may have attributes associated with them as well as children nodes.

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.


Fields inherited from class weblogic.apache.xalan.stree.Parent
m_childCount, m_posInChildList
 
Fields inherited from class weblogic.apache.xalan.stree.Child
m_doc, m_parent
 
Method Summary
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Create an attribute node.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create an attribute node with a namespace .
 int getAttrCount()
          Return the number of attributes in the list.
 java.lang.String getAttribute(java.lang.String name)
          Look up an attribute's value by name.
 org.w3c.dom.NamedNodeMap getAttributes()
          Get attributes of this node.
 AttrImpl getChildAttribute(int i)
          Get the nth attribute child.
 int getChildCount()
          Get the number of children this node currently contains.
 int getIndex(java.lang.String rawName)
          Look up the index of an attribute by raw XML 1.0 name.
 int getIndex(java.lang.String uri, java.lang.String localPart)
          Look up the index of an attribute by Namespace name.
 int getLength()
          The number of nodes (attributes) in this map.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 java.lang.String getLocalName(int index)
          Look up an attribute's local name by index.
 org.w3c.dom.Node getNamedItem(java.lang.String name)
          Get the child attribute with the specified attribute name
 org.w3c.dom.Node getNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
          Retrieves a node specified by local name and namespace URI.
 java.lang.String getNodeName()
          Returns the node name.
 short getNodeType()
          A short integer indicating what type of node this is.
 java.lang.String getQName(int index)
          Look up an attribute's raw XML 1.0 name by index.
 java.lang.String getTagName()
          Returns the tag name of this node.
 java.lang.String getType(int index)
          Look up an attribute's type by index.
 java.lang.String getType(java.lang.String rawName)
          Look up an attribute's type by raw XML 1.0 name.
 java.lang.String getType(java.lang.String uri, java.lang.String localName)
          Look up an attribute's type by Namespace name.
 java.lang.String getURI(int index)
          Look up an attribute's Namespace URI by index.
 java.lang.String getValue(int index)
          Look up an attribute's value by index.
 java.lang.String getValue(java.lang.String rawName)
          Look up an attribute's value by raw XML 1.0 name.
 java.lang.String getValue(java.lang.String uri, java.lang.String localName)
          Look up an attribute's value by Namespace name.
 org.w3c.dom.Node item(int index)
          Returns the index th item in the map.
 org.w3c.dom.Node removeItem(int index)
          Remove the attribute at the specified index from the attribute list
 org.w3c.dom.Node removeNamedItem(java.lang.String name)
          Removes a node specified by name.
 org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI, java.lang.String localName)
          Removes a node specified by local name and namespace URI.
 void setAttribute(java.lang.String name, java.lang.String value)
          Set attributes of this node.
 void setAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, java.lang.String value)
          Set attributes of this node.
 void setAttributes(org.xml.sax.Attributes atts)
          Set a list of attributes of this node.
 void setIDAttribute(java.lang.String value)
          Set the ID string to element association for this node.
 org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg)
          Adds a node using its nodeName attribute.
 org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg)
          Adds a node using its namespaceURI and localName .
 
Methods inherited from class weblogic.apache.xalan.stree.Parent
appendChild, dispatchCharactersEvent, getChild, getChildUID, getFirstChild, getLastChild, hasChildNodes, isComplete, setComplete, throwParseError
 
Methods inherited from class weblogic.apache.xalan.stree.Child
getLevel, getNamespaceURI, getNextSibling, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTransformer, getUid, isNamespaceNode, isSupported, setDoc, setLevel, setParent, setUid, throwIfParseError
 
Methods inherited from class weblogic.apache.xml.utils.UnImplNode
appendData, cloneNode, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, deleteData, error, error, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildNodes, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getImplementation, getNodeValue, getOwnerElement, getSpecified, hasAttribute, hasAttributeNS, hasAttributes, importNode, insertBefore, insertData, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttributeNode, setAttributeNodeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getNodeType

public short getNodeType()
A short integer indicating what type of node this is. The named constants for this value are defined in the org.w3c.dom.Node interface.

Returns:
This node's type
Overrides:
getNodeType in class UnImplNode

getNodeName

public java.lang.String getNodeName()
Returns the node name.

Returns:
This node's name
Overrides:
getNodeName in class UnImplNode

getLocalName

public java.lang.String getLocalName()
Returns the local part of the qualified name of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Returns:
the local part of the qualified name of this node
Overrides:
getLocalName in class Child

getTagName

public java.lang.String getTagName()
Returns the tag name of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Returns:
the tag name of this node
Overrides:
getTagName in class Child

getChildAttribute

public AttrImpl getChildAttribute(int i)
                           throws java.lang.ArrayIndexOutOfBoundsException,
                                  java.lang.NullPointerException
Get the nth attribute child.

Parameters:
i - the index of the child.
Returns:
the attribute child at the specified position
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index is out of bounds.
java.lang.NullPointerException - if there are no children.

getChildCount

public int getChildCount()
Get the number of children this node currently contains. Factor in the number of attributes at beginning of list. Note that this will only return the number of children added so far. If the isComplete property is false, it is likely that more children will be added. DON'T CALL THIS FUNCTION IF YOU CAN HELP IT!!!!!!

Returns:
the number of children this node currently contains
Overrides:
getChildCount in class Parent

getAttributes

public org.w3c.dom.NamedNodeMap getAttributes()
Get attributes of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Returns:
a NamedNodeMap containing this node's attributes
Overrides:
getAttributes in class Child

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws org.w3c.dom.DOMException
Set attributes of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Parameters:
name - attribute name
value - attribute value
Throws:
org.w3c.dom.DOMException -  
Overrides:
setAttribute in class Child

setAttributeNS

public void setAttributeNS(java.lang.String namespaceURI,
                           java.lang.String qualifiedName,
                           java.lang.String value)
                    throws org.w3c.dom.DOMException
Set attributes of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Parameters:
namespaceURI - Attribute name space
qualifiedName - Attribute qualified name
value - Attribute value
Throws:
org.w3c.dom.DOMException -  
Overrides:
setAttributeNS in class UnImplNode

setAttributes

public void setAttributes(org.xml.sax.Attributes atts)
                   throws org.w3c.dom.DOMException
Set a list of attributes of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.

Parameters:
atts - List of attributes to set for this node
Throws:
org.w3c.dom.DOMException -  

setIDAttribute

public void setIDAttribute(java.lang.String value)
Set the ID string to element association for this node.

Parameters:
value - The ID string, should not be null.

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Create an attribute node.

Parameters:
name - Attribute name to create
Returns:
the created attribute object
Throws:
org.w3c.dom.DOMException -  
Overrides:
createAttribute in class UnImplNode

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Create an attribute node with a namespace .

Parameters:
namespaceURI - name space of the attribute to create
qualifiedName - qualified name of the attribute to create
Returns:
the created attribute object
Throws:
org.w3c.dom.DOMException -  
Overrides:
createAttributeNS in class UnImplNode

getAttrCount

public int getAttrCount()
Return the number of attributes in the list.

Returns:
The number of attributes in the list.

getURI

public java.lang.String getURI(int index)
Look up an attribute's Namespace URI by index.
Specified by:
getURI in interface org.xml.sax.Attributes

Parameters:
index - The attribute index (zero-based).
Returns:
The Namespace URI, or the empty string if none is available, or null if the index is out of range.

getLocalName

public java.lang.String getLocalName(int index)
Look up an attribute's local name by index.
Specified by:
getLocalName in interface org.xml.sax.Attributes

Parameters:
index - The attribute index (zero-based).
Returns:
The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range.

getQName

public java.lang.String getQName(int index)
Look up an attribute's raw XML 1.0 name by index.
Specified by:
getQName in interface org.xml.sax.Attributes

Parameters:
index - The attribute index (zero-based).
Returns:
The raw XML 1.0 name, or the empty string if none is available, or null if the index is out of range.

getType

public java.lang.String getType(int index)
Look up an attribute's type by index.
Specified by:
getType in interface org.xml.sax.Attributes

Parameters:
index - The attribute index (zero-based).
Returns:
The attribute's type as a string, or null if the index is out of range.

getValue

public java.lang.String getValue(int index)
Look up an attribute's value by index.
Specified by:
getValue in interface org.xml.sax.Attributes

Parameters:
index - The attribute index (zero-based).
Returns:
The attribute's value as a string, or null if the index is out of range.

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Look up an attribute's value by name.

Parameters:
name - The attribute name to look up
Returns:
The attribute's value as a string, or null if the index is out of range.
Overrides:
getAttribute in class UnImplNode

getIndex

public int getIndex(java.lang.String uri,
                    java.lang.String localPart)
Look up the index of an attribute by Namespace name.
Specified by:
getIndex in interface org.xml.sax.Attributes

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

getIndex

public int getIndex(java.lang.String rawName)
Look up the index of an attribute by raw XML 1.0 name.
Specified by:
getIndex in interface org.xml.sax.Attributes

Parameters:
rawName - The raw (prefixed) name.
Returns:
The index of the attribute, or -1 if it does not appear in the list.

getType

public java.lang.String getType(java.lang.String uri,
                                java.lang.String localName)
Look up an attribute's type by Namespace name.
Specified by:
getType in interface org.xml.sax.Attributes

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

getType

public java.lang.String getType(java.lang.String rawName)
Look up an attribute's type by raw XML 1.0 name.
Specified by:
getType in interface org.xml.sax.Attributes

Parameters:
rawName - The raw XML 1.0 name.
Returns:
The attribute type as a string, or null if the attribute is not in the list or if raw names are not available.

getValue

public java.lang.String getValue(java.lang.String uri,
                                 java.lang.String localName)
Look up an attribute's value by Namespace name.
Specified by:
getValue in interface org.xml.sax.Attributes

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

getValue

public java.lang.String getValue(java.lang.String rawName)
Look up an attribute's value by raw XML 1.0 name.
Specified by:
getValue in interface org.xml.sax.Attributes

Parameters:
rawName - The raw XML 1.0 name.
Returns:
The attribute value as a string, or null if the attribute is not in the list or if raw names are not available.

getNamedItem

public org.w3c.dom.Node getNamedItem(java.lang.String name)
Get the child attribute with the specified attribute name
Specified by:
getNamedItem in interface org.w3c.dom.NamedNodeMap

Parameters:
name - Attribute name to look up
Returns:
The found attribute node or null if not found

setNamedItem

public org.w3c.dom.Node setNamedItem(org.w3c.dom.Node arg)
                              throws org.w3c.dom.DOMException
Adds a node using its nodeName attribute. If a node with that name is already present in this map, it is replaced by the new one.
As the nodeName attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.
Specified by:
setNamedItem in interface org.w3c.dom.NamedNodeMap

Parameters:
arg - A node to store in this map. The node will later be accessible using the value of its nodeName attribute.
Returns:
If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
org.w3c.dom.DOMException - WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

removeNamedItem

public org.w3c.dom.Node removeNamedItem(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Removes a node specified by name. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.
Specified by:
removeNamedItem in interface org.w3c.dom.NamedNodeMap

Parameters:
name - The nodeName of the node to remove.
Returns:
The node removed from this map if a node with such a name exists.
Throws:
org.w3c.dom.DOMException - NOT_FOUND_ERR: Raised if there is no node named name in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

removeItem

public org.w3c.dom.Node removeItem(int index)
                            throws org.w3c.dom.DOMException
Remove the attribute at the specified index from the attribute list

Parameters:
index - Position of attribute to remove in attribute list
Returns:
the removed attribute or null if not found
Throws:
org.w3c.dom.DOMException -  

getLength

public int getLength()
The number of nodes (attributes) in this map. The range of valid child node indices is 0 to length-1 inclusive.
Specified by:
getLength in interface org.xml.sax.Attributes

Returns:
The nunber of attribute nodes associated with this element.
Overrides:
getLength in class UnImplNode

item

public org.w3c.dom.Node item(int index)
Returns the index th item in the map. If index is greater than or equal to the number of nodes in this map, this returns null .
Specified by:
item in interface org.w3c.dom.NamedNodeMap

Parameters:
index - Index into this map.
Returns:
The node at the index th position in the map, or null if that is not a valid index.
Overrides:
item in class UnImplNode

getNamedItemNS

public org.w3c.dom.Node getNamedItemNS(java.lang.String namespaceURI,
                                       java.lang.String localName)
Retrieves a node specified by local name and namespace URI. HTML-only DOM implementations do not need to implement this method.
Specified by:
getNamedItemNS in interface org.w3c.dom.NamedNodeMap

Parameters:
namespaceURI - The namespace URI of the node to retrieve.
localName - The local name of the node to retrieve.
Returns:
A Node (of any type) with the specified local name and namespace URI, or null if they do not identify any node in this map.

setNamedItemNS

public org.w3c.dom.Node setNamedItemNS(org.w3c.dom.Node arg)
                                throws org.w3c.dom.DOMException
Adds a node using its namespaceURI and localName . If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one.
HTML-only DOM implementations do not need to implement this method.
Specified by:
setNamedItemNS in interface org.w3c.dom.NamedNodeMap

Parameters:
arg - A node to store in this map. The node will later be accessible using the value of its namespaceURI and localName attributes.
Returns:
If the new Node replaces an existing node the replaced Node is returned, otherwise null is returned.
Throws:
org.w3c.dom.DOMException - WRONG_DOCUMENT_ERR: Raised if arg was created from a different document than the one that created this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
INUSE_ATTRIBUTE_ERR: Raised if arg is an Attr that is already an attribute of another Element object. The DOM user must explicitly clone Attr nodes to re-use them in other elements.

removeNamedItemNS

public org.w3c.dom.Node removeNamedItemNS(java.lang.String namespaceURI,
                                          java.lang.String localName)
                                   throws org.w3c.dom.DOMException
Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the Node interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.
HTML-only DOM implementations do not need to implement this method.
Specified by:
removeNamedItemNS in interface org.w3c.dom.NamedNodeMap

Parameters:
namespaceURI - The namespace URI of the node to remove.
localName - The local name of the node to remove.
Returns:
The node removed from this map if a node with such a local name and namespace URI exists.
Throws:
org.w3c.dom.DOMException - NOT_FOUND_ERR: Raised if there is no node with the specified namespaceURI and localName in this map.
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs61

WebLogic classes and methods that do not appear in this reference are not public and are not supported.