|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.icl.saxon.om.AbstractNode
|
+--com.icl.saxon.tree.NodeImpl
|
+--com.icl.saxon.tree.ParentNodeImpl
|
+--com.icl.saxon.tree.ElementImpl
|
+--com.icl.saxon.tree.ElementWithAttributes
A node in the XML parse tree representing an XML element.
This class is an implementation of NodeInfo
| Field Summary | |
|---|---|
protected AttributeCollection |
attributeList
|
protected int[] |
namespaceList
|
| Fields inherited from class com.icl.saxon.tree.ElementImpl |
|---|
nameCode, root, sequence |
| Fields inherited from class com.icl.saxon.tree.NodeImpl |
|---|
emptyArray, index, parent |
| Fields inherited from class com.icl.saxon.om.AbstractNode |
|---|
NODE_LETTER |
| Fields inherited from interface org.w3c.dom.Node |
|---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
| Fields inherited from interface com.icl.saxon.om.NodeInfo |
|---|
ATTRIBUTE, COMMENT, ELEMENT, NAMESPACE, NODE, NONE, NUMBER_OF_TYPES, PI, ROOT, TEXT |
| Constructor Summary | |
|---|---|
ElementWithAttributes()
|
|
| Method Summary | |
|---|---|
void |
addNamespaceNodes(ElementImpl owner,
java.util.Vector list,
boolean addXML)
Make the set of all namespace nodes associated with this element. |
void |
copy(Outputter out,
boolean allNamespaces)
Copy this node to a given outputter (supporting xsl:copy-of) |
java.lang.String |
getAttribute(java.lang.String name)
Retrieves an attribute value by name. |
AttributeCollection |
getAttributeList()
Get the attribute list for this element. |
Attr |
getAttributeNode(java.lang.String name)
Retrieves an attribute node by name. |
Attr |
getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an Attr node by local name and namespace URI. |
java.lang.String |
getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Retrieves an attribute value by local name and namespace URI. |
NamedNodeMap |
getAttributes()
A NamedNodeMap containing the attributes of this element. |
java.lang.String |
getAttributeValue(int fingerprint)
Get the value of a given attribute of this node |
java.lang.String |
getAttributeValue(java.lang.String name)
Find the value of a given attribute of this element. |
java.lang.String |
getAttributeValue(java.lang.String uri,
java.lang.String localName)
Find the value of a given attribute of this node. |
int |
getLength()
Get number of attributes (DOM NamedNodeMap method). |
Node |
getNamedItem(java.lang.String name)
Get named attribute (DOM NamedNodeMap method) Treats namespace declarations as attributes. |
Node |
getNamedItemNS(java.lang.String uri,
java.lang.String localName)
Get named attribute (DOM NamedNodeMap method) Treats namespace declarations as attributes. |
protected int[] |
getNamespaceCodes()
Get the list of in-scope namespaces for this element as an array of namespace codes. |
java.lang.String |
getPrefixForURI(java.lang.String uri)
Search the NamespaceList for a given URI, returning the corresponding prefix. |
short |
getURICodeForPrefix(java.lang.String prefix)
Search the NamespaceList for a given prefix, returning the corresponding URI. |
boolean |
hasAttribute(java.lang.String name)
Returns true when an attribute with a given name is
specified on this element or has a default value, false
otherwise. |
boolean |
hasAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Returns true when an attribute with a given local name
and namespace URI is specified on this element or has a default value,
false otherwise. |
boolean |
hasAttributes()
Returns whether this node (if it is an element) has any attributes. |
void |
initialise(int nameCode,
AttributeCollection atts,
NodeInfo parent,
java.lang.String baseURI,
int lineNumber,
int sequenceNumber)
Initialise a new ElementWithAttributes with an element name and attribute list |
Node |
item(int index)
Get n'th attribute (DOM NamedNodeMap method). |
void |
outputNamespaceNodes(Outputter out,
boolean includeAncestors)
Output all namespace nodes associated with this element. |
void |
removeAttribute(java.lang.String name)
Removes an attribute by name. |
Attr |
removeAttributeNode(Attr oldAttr)
Removes the specified attribute node. |
void |
removeAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
Removes an attribute by local name and namespace URI. |
Node |
removeNamedItem(java.lang.String name)
Remove named attribute (DOM NamedNodeMap method: always fails) |
Node |
removeNamedItemNS(java.lang.String uri,
java.lang.String localName)
Remove named attribute (DOM NamedNodeMap method: always fails) |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Set the value of an attribute on the current element. |
Attr |
setAttributeNode(Attr newAttr)
Adds a new attribute node. |
Attr |
setAttributeNodeNS(Attr newAttr)
Add a new attribute. |
void |
setAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
java.lang.String value)
Adds a new attribute. |
Node |
setNamedItem(Node arg)
Set named attribute (DOM NamedNodeMap method: always fails) |
Node |
setNamedItemNS(Node arg)
Set named attribute (DOM NamedNodeMap method: always fails) |
void |
setNamespaceDeclarations(int[] namespaces,
int namespacesUsed)
Set the namespace declarations for the element |
| Methods inherited from class com.icl.saxon.tree.ElementImpl |
|---|
addChild, compact, copy, copyStringValue, dropChildren, enumerateChildren, generateId, getBaseURI, getChildNodes, getDocumentRoot, getFirstChild, getLastChild, getLineNumber, getNameCode, getNodeType, getNodeValue, getNthChild, getSequenceNumber, getStringValue, getSystemId, hasChildNodes, makeNameCode, removeChild, renumberChildren, setLineNumber, setNameCode, setSystemId, useChildrenArray |
| Methods inherited from class com.icl.saxon.tree.NodeImpl |
|---|
compareOrder, getDisplayName, getDocumentElement, getEnumeration, getFingerprint, getLocalName, getNamePool, getNextInDocument, getNextSibling, getOriginatingNode, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getURI, isSameNode, removeNode |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Element |
|---|
getElementsByTagName, getElementsByTagNameNS, getTagName |
| Methods inherited from interface org.w3c.dom.Node |
|---|
appendChild, cloneNode, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix |
| Field Detail |
protected AttributeCollection attributeList
protected int[] namespaceList
| Constructor Detail |
public ElementWithAttributes()
| Method Detail |
public void initialise(int nameCode,
AttributeCollection atts,
NodeInfo parent,
java.lang.String baseURI,
int lineNumber,
int sequenceNumber)
initialise in class ElementImplatts - The attribute list, after namespace processingparent - The parent node
public void setNamespaceDeclarations(int[] namespaces,
int namespacesUsed)
public short getURICodeForPrefix(java.lang.String prefix)
throws NamespaceException
getURICodeForPrefix in class ElementImplprefix - The prefix to be matched. To find the default namespace, supply ""
NamespaceException - if the prefix has not been declared on this NamespaceList.public java.lang.String getPrefixForURI(java.lang.String uri)
getPrefixForURI in class ElementImpluri - The URI to be matched.
public void addNamespaceNodes(ElementImpl owner,
java.util.Vector list,
boolean addXML)
addNamespaceNodes in class ElementImplowner - The element owning these namespace nodes.list - a Vector containing NamespaceImpl objects representing the namespaces
in scope for this element; the method appends nodes to this Vector, which should
initially be empty. Note that the returned list will never contain the XML namespace
(to get this, the NamespaceEnumeration class adds it itself). The list WILL include
an entry for the undeclaration xmlns=""; again it is the job of NamespaceEnumeration
to ignore this, since it doesn't represent a true namespace node.addXML - Add a namespace node for the XML namespace
public void outputNamespaceNodes(Outputter out,
boolean includeAncestors)
throws TransformerException
outputNamespaceNodes in interface NodeInfooutputNamespaceNodes in class ElementImplout - The relevant outputter
TransformerExceptionprotected int[] getNamespaceCodes()
public AttributeCollection getAttributeList()
getAttributeList in class ElementImplpublic boolean hasAttributes()
hasAttributes in interface NodehasAttributes in class NodeImpltrue if this node has any attributes,
false otherwise.
public java.lang.String getAttributeValue(java.lang.String uri,
java.lang.String localName)
getAttributeValue in interface NodeInfogetAttributeValue in class NodeImpluri - the namespace uri of an attributelocalName - the local name of an attribute
public java.lang.String getAttributeValue(java.lang.String name)
getAttributeValue in class ElementImplname - the name of an attribute. There must be no prefix in the name.
public java.lang.String getAttributeValue(int fingerprint)
getAttributeValue in interface NodeInfogetAttributeValue in class NodeImplfingerprint - The fingerprint of the attribute name
public void setAttribute(java.lang.String name,
java.lang.String value)
throws DOMException
setAttribute in interface ElementsetAttribute in class ElementImplname - The name of the attribute to be set. Any prefix is interpreted relative
to the namespaces defined for this element.value - The new value of the attribute. Set this to null to remove the attribute.
DOMException - (always): Saxon trees are immutable.
public void copy(Outputter out,
boolean allNamespaces)
throws TransformerException
copy in class ElementImplout - The outputterallNamespaces - true if namespaces for ancestor nodes must be output
TransformerExceptionpublic java.lang.String getAttribute(java.lang.String name)
getAttribute in interface ElementgetAttribute in class AbstractNodename - The name of the attribute to retrieve.
Attr value as a string, or the empty string if
that attribute does not have a specified or default value. (Note the
difference from getAttributeValue(), which returns null if there is no
value).public NamedNodeMap getAttributes()
NamedNodeMap containing the attributes of this element. This
is a DOM method, so the list of attributes includes namespace declarations.
getAttributes in interface NodegetAttributes in class NodeImplpublic void removeAttribute(java.lang.String name)
removeAttribute in interface ElementremoveAttribute in class AbstractNodename - The name of the attribute to remove.public Attr getAttributeNode(java.lang.String name)
getAttributeNodeNS method.
getAttributeNode in interface ElementgetAttributeNode in class AbstractNodename - The name (nodeName ) of the attribute to
retrieve.
Attr node with the specified name (
nodeName ) or null if there is no such
attribute.
public Attr setAttributeNode(Attr newAttr)
throws DOMException
setAttributeNode in interface ElementsetAttributeNode in class AbstractNodeDOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
public Attr removeAttributeNode(Attr oldAttr)
throws DOMException
removeAttributeNode in interface ElementremoveAttributeNode in class AbstractNodeDOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
public java.lang.String getAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
getAttributeNS in interface ElementgetAttributeNS in class AbstractNodenamespaceURI - The namespace URI of the attribute to retrieve.localName - The local name of the attribute to retrieve.
Attr value as a string, or the empty string if
that attribute does not have a specified or default value.
public void setAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
java.lang.String value)
throws DOMException
setAttributeNS in interface ElementsetAttributeNS in class AbstractNodenamespaceURI - The namespace URI of the attribute to create or
alter.qualifiedName - The qualified name of the attribute to create or
alter.value - The value to set in string form.
DOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
public void removeAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
throws DOMException
removeAttributeNS in interface ElementremoveAttributeNS in class AbstractNodeDOMException - NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
public Attr getAttributeNodeNS(java.lang.String namespaceURI,
java.lang.String localName)
Attr node by local name and namespace URI.
DOM method, so namespace declarations count as attributes.
getAttributeNodeNS in interface ElementgetAttributeNodeNS in class AbstractNodenamespaceURI - The namespace URI of the attribute to retrieve.localName - The local name of the attribute to retrieve.
Attr node with the specified attribute local
name and namespace URI or null if there is no such
attribute.
public Attr setAttributeNodeNS(Attr newAttr)
throws DOMException
setAttributeNodeNS in interface ElementsetAttributeNodeNS in class AbstractNodenewAttr - The Attr node to add to the attribute list.
newAttr attribute replaces an existing
attribute with the same local name and namespace URI , the
replaced Attr node is returned, otherwise
null is returned.
DOMException - public boolean hasAttribute(java.lang.String name)
true when an attribute with a given name is
specified on this element or has a default value, false
otherwise. Namespace declarations are not included.
hasAttribute in interface ElementhasAttribute in class AbstractNodename - The name of the attribute to look for.
true if an attribute with the given name is
specified on this element or has a default value, false
otherwise.
public boolean hasAttributeNS(java.lang.String namespaceURI,
java.lang.String localName)
true when an attribute with a given local name
and namespace URI is specified on this element or has a default value,
false otherwise. This is a DOM method so namespace declarations
are treated as attributes.
hasAttributeNS in interface ElementhasAttributeNS in class AbstractNodenamespaceURI - The namespace URI of the attribute to look for.localName - The local name of the attribute to look for.
true if an attribute with the given local name and
namespace URI is specified or has a default value on this element,
false otherwise.public Node getNamedItem(java.lang.String name)
getNamedItem in interface NamedNodeMap
public Node setNamedItem(Node arg)
throws DOMException
setNamedItem in interface NamedNodeMapDOMException
public Node removeNamedItem(java.lang.String name)
throws DOMException
removeNamedItem in interface NamedNodeMapDOMExceptionpublic Node item(int index)
item in interface NamedNodeMappublic int getLength()
getLength in interface NamedNodeMapgetLength in class AbstractNode
public Node getNamedItemNS(java.lang.String uri,
java.lang.String localName)
getNamedItemNS in interface NamedNodeMap
public Node setNamedItemNS(Node arg)
throws DOMException
setNamedItemNS in interface NamedNodeMapDOMException
public Node removeNamedItemNS(java.lang.String uri,
java.lang.String localName)
throws DOMException
removeNamedItemNS in interface NamedNodeMapDOMException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||