Class PMRElementImpl
java.lang.Object
org.episteme.natural.chemistry.loaders.cml.dom.pmr.PMRNodeImpl
org.episteme.natural.chemistry.loaders.cml.dom.pmr.PMRElementImpl
- Direct Known Subclasses:
CMLBaseImpl
Delegation-based implementation
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Field Summary
Fields inherited from class PMRNodeImpl
childNodes, delegateNode, parentNode, pmrDocument, siblingNodesFields inherited from interface 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
ConstructorsModifierConstructorDescriptionprotectedonly for use by subclass constructorsprotectedPMRElementImpl(PMRDocument pmrDoc, String tagName) protectedPMRElementImpl(Element element, PMRDocument doc) -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) Retrieves an attribute value by name.getAttributeNode(String name) Retrieves anAttrnode by name.getAttributeNodeNS(String s, String t) getAttributeNS(String s, String t) getElementsByTagName(String name) Returns aNodeListof all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of theElementtree.NOT YET IMPLEMENTEDThe type information associated with this element.The name of the element.booleanbooleanhasAttributeNS(String s, String t) voidPuts allTextnodes in the full depth of the sub-tree underneath thisElementinto a "normal" form where only markup (for example, tags, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, that is , there are no adjacentTextnodes.voidremoveAttribute(String name) Removes an attribute by name.removeAttributeNode(Attr oldAttr) Removes the specified attribute.voidremoveAttributeNS(String s, String t) voidsetAttribute(String name, String value) Adds a new attribute.setAttributeNode(Attr newAttr) Adds a new attribute.setAttributeNodeNS(Attr attr) voidsetAttributeNS(String s, String t, String v) voidsetIdAttribute(String name, boolean isId) If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute .voidsetIdAttributeNode(Attr idAttr, boolean isId) If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute .voidsetIdAttributeNS(String namespaceURI, String localName, boolean isId) If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute .Methods inherited from class PMRNodeImpl
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getDelegateNode, getDelegateParentNode, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, removeChild, replaceChild, setDelegateNode, setNodeValue, setOwnerDocument, setOwnerDocumentRecursively, setPrefix, setTextContent, setUserData, toString, wrapRecursivelyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, 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, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
Constructor Details
-
PMRElementImpl
protected PMRElementImpl()only for use by subclass constructors -
PMRElementImpl
-
PMRElementImpl
-
-
Method Details
-
getTagName
The name of the element. For example, in: <elementExample id="demo"> ... </elementExample> ,tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.- Specified by:
getTagNamein interfaceElement
-
getAttribute
Retrieves an attribute value by name.- Specified by:
getAttributein interfaceElement- Parameters:
name- The 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.
-
setAttribute
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string, it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.- 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 contains an invalid character.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
removeAttribute
Removes an attribute by name. If the removed attribute has a default value it is immediately replaced.- Specified by:
removeAttributein interfaceElement- Parameters:
name- The name of the attribute to remove.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
getAttributeNode
Retrieves anAttrnode by name.- Specified by:
getAttributeNodein interfaceElement- Parameters:
name- The name of the attribute to retrieve.- Returns:
- The
Attrnode with the specified attribute name ornullif there is no such attribute.
-
setAttributeNode
Adds a new attribute. If an attribute with that name is already present in the element, it is replaced by the new one.- Specified by:
setAttributeNodein interfaceElement- Parameters:
newAttr- TheAttrnode to add to the attribute list.- Returns:
- If the
newAttrattribute replaces an existing attribute with the same name, the previously existingAttrnode is returned, otherwisenullis returned. - Throws:
DOMException- WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.
NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.
-
removeAttributeNode
Removes the specified attribute.- Specified by:
removeAttributeNodein interfaceElement- Parameters:
oldAttr- TheAttrnode to remove from the attribute list. If the removedAttrhas a default value it is immediately replaced.- Returns:
- The
Attrnode that was removed. - Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.
-
getElementsByTagName
Returns aNodeListof all descendant elements with a given tag name, in the order in which they would be encountered in a preorder traversal of theElementtree.- 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.
-
normalize
public void normalize()Puts allTextnodes in the full depth of the sub-tree underneath thisElementinto a "normal" form where only markup (for example, tags, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, that is , there are no adjacentTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.- Specified by:
normalizein interfaceNode- Overrides:
normalizein classPMRNodeImpl
-
removeAttributeNS
- Specified by:
removeAttributeNSin interfaceElement
-
getAttributeNodeNS
- Specified by:
getAttributeNodeNSin interfaceElement
-
setAttributeNodeNS
- Specified by:
setAttributeNodeNSin interfaceElement
-
hasAttributeNS
- Specified by:
hasAttributeNSin interfaceElement
-
hasAttribute
- Specified by:
hasAttributein interfaceElement
-
setAttributeNS
- Specified by:
setAttributeNSin interfaceElement
-
getAttributeNS
- Specified by:
getAttributeNSin interfaceElement
-
getSchemaTypeInfo
The type information associated with this element.- Specified by:
getSchemaTypeInfoin interfaceElement- Since:
- DOM Level 3
-
setIdAttribute
If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.
To specify an attribute by local name and namespace URI, use thesetIdAttributeNSmethod.- Specified by:
setIdAttributein interfaceElement- Parameters:
name- The name of the attribute.isId- Whether the attribute is a of type ID.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.- Since:
- DOM Level 3
-
setIdAttributeNS
public void setIdAttributeNS(String namespaceURI, String localName, boolean isId) throws DOMException If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.- Specified by:
setIdAttributeNSin interfaceElement- Parameters:
namespaceURI- The namespace URI of the attribute.localName- The local name of the attribute.isId- Whether the attribute is a of type ID.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.- Since:
- DOM Level 3
-
setIdAttributeNode
If the parameterisIdistrue, this method declares the specified attribute to be a user-determined ID attribute . This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being a user-determined ID attribute.- Specified by:
setIdAttributeNodein interfaceElement- Parameters:
idAttr- The attribute node.isId- Whether the attribute is a of type ID.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.- Since:
- DOM Level 3
-
getElementsByTagNameNS
NOT YET IMPLEMENTED- Specified by:
getElementsByTagNameNSin interfaceElement
-