Package net.sf.saxon.dom
Class ElementOverNodeInfo
java.lang.Object
net.sf.saxon.dom.NodeOverNodeInfo
net.sf.saxon.dom.ElementOverNodeInfo
This class is an implementation of the DOM Element class that wraps a Saxon NodeInfo
representation of an element node.
The class provides read-only access to the tree; methods that request updates all fail with an UnsupportedOperationException.
Note that contrary to the DOM specification, this implementation does not expose namespace declarations as attributes.
-
Field Summary
Fields inherited from class net.sf.saxon.dom.NodeOverNodeInfo
nodeFields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Retrieves an attribute value by name.getAttributeNode(String name) Retrieves an attribute node by name.getAttributeNodeNS(String namespaceURI, String localName) Retrieves anAttrnode by local name and namespace URI.getAttributeNS(String namespaceURI, String localName) Retrieves an attribute value by local name and namespace URI.Return aNamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.getElementsByTagName(String name) Returns aNodeListof all descendantElementswith a given tag name, in document order.getElementsByTagNameNS(String namespaceURI, String localName) Returns aNodeListof all the descendantElementswith a given local name and namespace URI in document order.Get the schema type information for this node.The name of the element (DOM interface).booleanhasAttribute(String name) Returnstruewhen an attribute with a given name is specified on this element or has a default value,falseotherwise.booleanhasAttributeNS(String namespaceURI, String localName) Returnstruewhen an attribute with a given local name and namespace URI is specified on this element or has a default value,falseotherwise.voidremoveAttribute(String oldAttr) Removes the specified attribute.removeAttributeNode(Attr oldAttr) Removes the specified attribute node.voidremoveAttributeNS(String namespaceURI, String localName) Removes an attribute by local name and namespace URI.voidsetAttribute(String name, String value) Adds a new attribute.setAttributeNode(Attr newAttr) Adds a new attribute node.setAttributeNodeNS(Attr newAttr) Add a new attribute.voidsetAttributeNS(String namespaceURI, String qualifiedName, String value) Adds a new attribute.voidsetIdAttribute(String name, boolean isId) Mark an attribute as an ID.voidsetIdAttributeNode(Attr idAttr, boolean isId) Mark an attribute as an ID.voidsetIdAttributeNS(String namespaceURI, String localName, boolean isId) Mark an attribute as an ID.Methods inherited from class net.sf.saxon.dom.NodeOverNodeInfo
appendChild, cloneNode, compareDocumentPosition, disallowUpdate, equals, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUnderlyingNodeInfo, getUserData, hasAttributes, hasChildNodes, hashCode, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData, wrapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Constructor Details
-
ElementOverNodeInfo
public ElementOverNodeInfo()
-
-
Method Details
-
getTagName
The name of the element (DOM interface).- Specified by:
getTagNamein interfaceElement
-
getElementsByTagName
Returns aNodeListof all descendantElementswith a given tag name, in document order.- Specified by:
getElementsByTagNamein interfaceElement- Parameters:
name- The name of the tag to match on. The special value "*" matches all tags.- Returns:
- A list of matching
Elementnodes.
-
getElementsByTagNameNS
Returns aNodeListof all the descendantElementswith a given local name and namespace URI in document order.- Specified by:
getElementsByTagNameNSin interfaceElement- Parameters:
namespaceURI- The namespace URI of the elements to match on. The special value "*" matches all namespaces.localName- The local name of the elements to match on. The special value "*" matches all local names.- Returns:
- A new
NodeListobject containing all the matchedElements. - Throws:
DOMException- NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as [HTML 4.01]).- Since:
- DOM Level 2
-
getAttributes
Return aNamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise. Note that namespace declarations are treated as attributes.- Specified by:
getAttributesin interfaceNode- Overrides:
getAttributesin classNodeOverNodeInfo
-
getAttribute
Retrieves an attribute value by name.- Specified by:
getAttributein interfaceElement- Parameters:
name- The QName of the attribute to retrieve.- Returns:
- The
Attrvalue as a string, or the empty string if that attribute does not have a specified or default value.
-
getAttributeNode
Retrieves an attribute node by name.
To retrieve an attribute node by qualified name and namespace URI, use thegetAttributeNodeNSmethod.- Specified by:
getAttributeNodein interfaceElement- Parameters:
name- The name (nodeName) of the attribute to retrieve.- Returns:
- The
Attrnode with the specified name (nodeName) ornullif there is no such attribute.
-
setAttributeNode
Adds a new attribute node. Always fails- Specified by:
setAttributeNodein interfaceElement- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
removeAttribute
Removes the specified attribute. Always fails- Specified by:
removeAttributein interfaceElement- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
removeAttributeNode
Removes the specified attribute node. Always fails- Specified by:
removeAttributeNodein interfaceElement- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
getAttributeNS
Retrieves an attribute value by local name and namespace URI. This implementation does not expose namespace nodes as attributes.- Specified by:
getAttributeNSin interfaceElement- Parameters:
namespaceURI- The namespace URI of the attribute to retrieve.localName- The local name of the attribute to retrieve.- Returns:
- The
Attrvalue as a string, or the empty string if that attribute does not have a specified or default value. - Since:
- DOM Level 2
-
setAttribute
Adds a new attribute. Always fails- Specified by:
setAttributein interfaceElement- Parameters:
name- The name of the attribute to create or alter.value- Value to set in string form.- Throws:
DOMException- INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
setAttributeNS
public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException Adds a new attribute. Always fails.- Specified by:
setAttributeNSin interfaceElement- Parameters:
namespaceURI- 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.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
removeAttributeNS
Removes an attribute by local name and namespace URI. Always fails- Specified by:
removeAttributeNSin interfaceElement- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.- Since:
- DOM Level 2
-
getAttributeNodeNS
Retrieves anAttrnode by local name and namespace URI. This implementation does not expose namespace nodes as attributes.- Specified by:
getAttributeNodeNSin interfaceElement- Parameters:
namespaceURI- The namespace URI of the attribute to retrieve.localName- The local name of the attribute to retrieve.- Returns:
- The
Attrnode with the specified attribute local name and namespace URI ornullif there is no such attribute. - Since:
- DOM Level 2
-
setAttributeNodeNS
Add a new attribute. Always fails.- Specified by:
setAttributeNodeNSin interfaceElement- Parameters:
newAttr- TheAttrnode to add to the attribute list.- Returns:
- If the
newAttrattribute replaces an existing attribute with the same local name and namespace URI , the replacedAttrnode is returned, otherwisenullis returned. - Throws:
DOMException-
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.- Since:
- DOM Level 2
-
hasAttribute
Returnstruewhen an attribute with a given name is specified on this element or has a default value,falseotherwise.- Specified by:
hasAttributein interfaceElement- Parameters:
name- The name of the attribute to look for.- Returns:
trueif an attribute with the given name is specified on this element or has a default value,falseotherwise.- Since:
- DOM Level 2
-
hasAttributeNS
Returnstruewhen an attribute with a given local name and namespace URI is specified on this element or has a default value,falseotherwise.- Specified by:
hasAttributeNSin interfaceElement- Parameters:
namespaceURI- The namespace URI of the attribute to look for.localName- The local name of the attribute to look for.- Returns:
trueif an attribute with the given local name and namespace URI is specified or has a default value on this element,falseotherwise.- Since:
- DOM Level 2
-
setIdAttribute
Mark an attribute as an ID. Always fails.- Specified by:
setIdAttributein interfaceElement- Throws:
UnsupportedOperationException- always
-
setIdAttributeNS
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws UnsupportedOperationException Mark an attribute as an ID. Always fails.- Specified by:
setIdAttributeNSin interfaceElement- Throws:
UnsupportedOperationException- always
-
setIdAttributeNode
Mark an attribute as an ID. Always fails.- Specified by:
setIdAttributeNodein interfaceElement- Throws:
UnsupportedOperationException- always
-
getSchemaTypeInfo
Get the schema type information for this node.- Specified by:
getSchemaTypeInfoin interfaceElement- Returns:
- the type information. Returns null for an untyped node.
-