- All Implemented Interfaces:
DOMNode
,NonDocumentTypeChildNode
,ParentNode
,CSSDocument
,CSSNode
,DocumentCSS
,Document
,Node
,DocumentStyle
HTML Document
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSDocument
CSSDocument.ComplianceMode
-
Field Summary
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionappendChild
(Node newChild) Adds the nodenewChild
to the end of the list of children of this node.cloneNode
(boolean deep) short
compareDocumentPosition
(Node other) boolean
Test ifnode
is an inclusive descendant of this node.createAttributeNS
(String namespaceURI, String qualifiedName) createElement
(String tagName) Creates an element of the type specified, with anull
namespace URI.createElementNS
(String namespaceURI, String qualifiedName) Creates an element with the given qualified name and namespace URI.Creates a new iterator descending over the child nodes, starting from the last child node.Creates a new iterator over the child elements.elementIterator
(String tagname) Creates a new iterator over the child elements of the given tagname.elementIteratorNS
(String namespaceURI, String localName) Creates a new iterator over the child elements of the given namespaceURI and localName.Gets the absolute base URI of this node.Gets the base URL of this Document.int
Gets the number of child nodes of type Element that this parent node has.Get the children of this node.Gets the live ElementList containing all nodes of type Element that are children of this Element.Get the child node which is the document element of this document.getElementsByTagName
(String name) Gives anElementList
of all the elements descending from this context node that have the given tag name, in document order.getElementsByTagNameNS
(String namespaceURI, String localName) Gives anElementList
of all the elements descending from this context node that have the given local name and namespace URI, in document order.getFeature
(String feature, String version) Deprecated.Get the first child of this node.Gets the Element that is the first child of this ParentNode.Get the last child of this node.Gets the DOMElement that is the last child of this ParentNode.Gives the local part of the qualified name of this node.Gets the first following sibling that is an element.Get the node immediately following this node in its parent's child list.short
Get theDOMDocument
object related to this node (for all nodes exceptDocumentType
, it is the document that created it), which is also the object that should be used to create new nodes for the document.Gets the first preceding sibling that is an element.Get the node immediately preceding this node in its parent's child list.getUserData
(String key) boolean
boolean
Does this node have any child nodes ?boolean
isDefaultNamespace
(String namespaceURI) boolean
isEqualNode
(Node arg) boolean
isSameNode
(Node other) boolean
isSupported
(String feature, String version) Deprecated.iterator()
Creates a new iterator over the child nodes.iterator
(int whatToShow, NodeFilter filter) Creates a new iterator over the child nodes.iterator
(NodeFilter filter) Creates a new iterator over the child nodes.Creates a new iterator over the child nodes.Creates a new list iterator over the child nodes.void
prependChild
(Node newChild) querySelectorAll
(String selectors) Gets a static list of the elements that match any of the specified group of selectors.removeChild
(Node oldChild) Removes the nodeoldChild
from the children of this node.void
setDocumentURI
(String documentURI) Sets the location of this document.void
setNodeValue
(String nodeValue) void
void
setTextContent
(String textContent) setUserData
(String key, Object data, UserDataHandler handler) typeIterator
(short typeToShow) Creates a new iterator over the child nodes.Methods inherited from class io.sf.carte.doc.dom.DOMDocument
adoptNode, createAttribute, createCDATASection, createComment, createDocumentFragment, createEntityReference, createNodeIterator, createProcessingInstruction, createTextNode, createTreeWalker, enableStyleSheetsForSet, getCanvas, getComplianceMode, getDoctype, getDocumentURI, getDomConfig, getElementById, getElementsByClassName, getErrorHandler, getImplementation, getInputEncoding, getLastStyleSheetSet, getNodeName, getOverrideStyle, getParentNode, getReferrerPolicy, getSelectedStyleSheetSet, getStrictErrorChecking, getStyleDatabase, getStyleSheet, getStyleSheetFactory, getStyleSheets, getStyleSheetSets, getTargetMedium, getURL, getXmlEncoding, getXmlStandalone, getXmlVersion, hasStyleIssues, importNode, insertBefore, isAuthorizedOrigin, isSafeOrigin, isVisitedURI, lookupNamespaceURI, lookupPrefix, normalizeDocument, onMetaAdded, onMetaRemoved, openStream, renameNode, replaceChild, setReferrerPolicyHeader, setSelectedStyleSheetSet, setStrictErrorChecking, setTargetMedium, setXmlStandalone, setXmlVersion, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.sf.carte.doc.style.css.CSSDocument
openConnection
Methods inherited from interface org.w3c.dom.Document
getElementsByTagName, getElementsByTagNameNS
Methods inherited from interface io.sf.carte.doc.dom.DOMNode
appendChild, getFirstChild, getLastChild, getNextSibling, getPreviousSibling, hasChildNodes, removeChild
Methods inherited from interface org.w3c.dom.Node
compareDocumentPosition, getAttributes, getFeature, getLocalName, getNamespaceURI, getNodeType, getNodeValue, getPrefix, getTextContent, getUserData, hasAttributes, isEqualNode, isSameNode, isSupported, normalize, setNodeValue, setPrefix, setTextContent, setUserData
Methods inherited from interface io.sf.carte.doc.dom.ParentNode
getChildElementCount, getChildNodes, getFirstElementChild, getLastElementChild, prependChild
-
Field Details
-
HTML_NAMESPACE_URI
- See Also:
-
-
Constructor Details
-
HTMLDocument
-
-
Method Details
-
getDocumentElement
Description copied from class:DOMDocument
Get the child node which is the document element of this document.- Specified by:
getDocumentElement
in interfaceCSSDocument
- Specified by:
getDocumentElement
in interfaceDocument
- Overrides:
getDocumentElement
in classDOMDocument
- Returns:
- the document element.
-
getOwnerDocument
Description copied from class:DOMDocument
Get theDOMDocument
object related to this node (for all nodes exceptDocumentType
, it is the document that created it), which is also the object that should be used to create new nodes for the document.- Specified by:
getOwnerDocument
in interfaceCSSNode
- Specified by:
getOwnerDocument
in interfaceDOMNode
- Specified by:
getOwnerDocument
in interfaceNode
- Overrides:
getOwnerDocument
in classDOMDocument
- Returns:
- the
DOMDocument
object corresponding to this node. When this node is aDOMDocument
or aDocumentType
which was not added to anyDOMDocument
yet, this isnull
.
-
cloneNode
Description copied from class:DOMDocument
- Specified by:
cloneNode
in interfaceNode
- Overrides:
cloneNode
in classDOMDocument
-
createElement
Description copied from class:DOMDocument
Creates an element of the type specified, with anull
namespace URI.The
tagName
is transformed to lower case.No default attributes are created.
- Specified by:
createElement
in interfaceCSSDocument
- Specified by:
createElement
in interfaceDocument
- Overrides:
createElement
in classDOMDocument
- Parameters:
tagName
- the tag name of the element to create.- Returns:
- the new
DOMElement
. - Throws:
DOMException
- INVALID_CHARACTER_ERR if the name is not an XML valid name.
-
createElementNS
Description copied from class:DOMDocument
Creates an element with the given qualified name and namespace URI.If
namespaceURI
isnull
or the empty string, thequalifiedName
is transformed to lower case.No default attributes are created.
- Specified by:
createElementNS
in interfaceCSSDocument
- Specified by:
createElementNS
in interfaceDocument
- Overrides:
createElementNS
in classDOMDocument
- Parameters:
namespaceURI
- the namespace URI of the element to create.qualifiedName
- the qualified name of the element to create. The namespace prefix, if any, is extracted from this name.- Returns:
- the new
DOMElement
. - Throws:
DOMException
- INVALID_CHARACTER_ERR if the name is not an XML valid name.
NAMESPACE_ERR: if thequalifiedName
is a malformed qualified name, if thequalifiedName
has a prefix and the namespaceURI isnull
, or if thequalifiedName
has a prefix that is"xml"
and thenamespaceURI
is different from"http://www.w3.org/XML/1998/namespace"
, or if thequalifiedName
or its prefix is"xmlns"
and thenamespaceURI
is different from"http://www.w3.org/2000/xmlns/"
, or if thenamespaceURI
is"http://www.w3.org/2000/xmlns/"
and neither thequalifiedName
nor its prefix is"xmlns"
.
-
createAttributeNS
Description copied from class:DOMDocument
- Specified by:
createAttributeNS
in interfaceDocument
- Overrides:
createAttributeNS
in classDOMDocument
- Throws:
DOMException
-
getBaseURL
Gets the base URL of this Document.If the Document's
head
element has abase
child element, the base URI is computed using the value of the href attribute of thebase
element.- Specified by:
getBaseURL
in interfaceCSSDocument
- Overrides:
getBaseURL
in classDOMDocument
- Returns:
- the base URL, or
null
if no base URL could be found.
-
getBaseURI
Gets the absolute base URI of this node.- Specified by:
getBaseURI
in interfaceNode
- Overrides:
getBaseURI
in classDOMDocument
- Returns:
- the absolute base URI of this node, or
null
if an absolute URI could not be obtained.
-
setDocumentURI
Description copied from class:DOMDocument
Sets the location of this document.For security reasons, if you want to retrieve linked style sheets from local URLs (like
file:
), you need to set thedocumentURI
to a local scheme (file:
orjar:
) as well.No lexical checking is performed when setting this attribute; this could result in a
null
value returned when usingDOMDocument.getBaseURI()
.- Specified by:
setDocumentURI
in interfaceDocument
- Overrides:
setDocumentURI
in classDOMDocument
- Parameters:
documentURI
- the document URI.
-
isDefaultNamespace
- Specified by:
isDefaultNamespace
in interfaceNode
- Overrides:
isDefaultNamespace
in classDOMDocument
-
getChildren
Gets the live ElementList containing all nodes of type Element that are children of this Element.- Specified by:
getChildren
in interfaceParentNode
- Returns:
- the ElementList containing all nodes of type Element that are children of this Element.
-
querySelectorAll
Gets a static list of the elements that match any of the specified group of selectors.Unlike methods like
ParentNode.getElementsByTagName(String)
orParentNode.getElementsByClassName(String)
, this is not a live list but a static one, representing the state of the document when the method was called. If no elements match, the list will be empty.- Specified by:
querySelectorAll
in interfaceParentNode
- Parameters:
selectors
- a comma-separated list of selectors.- Returns:
- an ElementList with the elements that match any of the specified group of selectors.
-
iterator
Creates a new iterator over the child nodes.- Specified by:
iterator
in interfaceParentNode
- Returns:
- an iterator over the child nodes.
-
descendingIterator
Creates a new iterator descending over the child nodes, starting from the last child node.- Specified by:
descendingIterator
in interfaceParentNode
- Returns:
- an iterator descending over the child nodes.
-
iterator
Creates a new iterator over the child nodes.It only iterates over types set in the whatToShow bit field.
Example:
BitSet mask = new BitSet(32); mask.set(Node.ELEMENT_NODE); Iterator
it = node.iterator(mask); - Specified by:
iterator
in interfaceParentNode
- Parameters:
whatToShow
- a bit set.- Returns:
- an iterator over the child nodes.
-
elementIterator
Creates a new iterator over the child elements.- Specified by:
elementIterator
in interfaceParentNode
- Returns:
- an iterator over the child elements.
-
elementIterator
Creates a new iterator over the child elements of the given tagname.- Specified by:
elementIterator
in interfaceParentNode
- Parameters:
tagname
- The tag name of the child elements to match on.- Returns:
- an iterator over the child elements.
-
elementIteratorNS
Creates a new iterator over the child elements of the given namespaceURI and localName.- Specified by:
elementIteratorNS
in interfaceParentNode
- Parameters:
namespaceURI
- the namespace URI of the elements to match on.localName
- The local name of the elements to match on.- Returns:
- an iterator over the child elements.
-
iterator
Creates a new iterator over the child nodes.It only iterates over types set in the whatToShow mask that satisfy the custom
NodeFilter
.Example:
Iterator
it = node.iterator(NodeFilter.SHOW_ELEMENT, null); - Specified by:
iterator
in interfaceParentNode
- Parameters:
whatToShow
- the bit field mask to apply to the node types, seeNodeFilter
. Do not confuse this argument with theshort
argument of theParentNode.typeIterator(short)
method.filter
- the filter to use in the iteration. ifnull
, only thewhatToShow
mask filter is applied.- Returns:
- an iterator over the child nodes.
-
typeIterator
Creates a new iterator over the child nodes.Do not confuse the
typeToShow
argument with theint
argument of theParentNode.iterator(int, NodeFilter)
method, which is a bit field.- Specified by:
typeIterator
in interfaceParentNode
- Parameters:
typeToShow
- the node type to show (fromNode.getNodeType()
).- Returns:
- an iterator over the child nodes.
-
iterator
Creates a new iterator over the child nodes.It only iterates over nodes accepted by the filter.
- Specified by:
iterator
in interfaceParentNode
- Parameters:
filter
- a filter, seeNodeFilter
.- Returns:
- an iterator over the child nodes.
-
listIterator
Creates a new list iterator over the child nodes.- Specified by:
listIterator
in interfaceParentNode
- Returns:
- a list iterator over the child nodes.
-
getElementsByTagNameNS
Gives anElementList
of all the elements descending from this context node that have the given local name and namespace URI, in document order.The list is a live collection, and changes to the document made after calling this method are reflected in the
ElementList
.The most efficient way to browse the returned list is to iterate it.
- Specified by:
getElementsByTagNameNS
in interfaceParentNode
- 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:
- the
ElementList
object containing all the matched elements.
-
getElementsByTagName
Gives anElementList
of all the elements descending from this context node that have the given tag name, in document order.The list is a live collection, and changes to the document made after calling this method are reflected in the
ElementList
.The most efficient way to browse the returned list is to iterate it.
- Specified by:
getElementsByTagName
in interfaceParentNode
- Parameters:
name
- The tag name of the elements to match on. The special value "*
" matches all tag names.- Returns:
- the
ElementList
object containing all the matched elements.
-
getFirstElementChild
Gets the Element that is the first child of this ParentNode.- Returns:
- the Element that is the first child of this ParentNode, or null if there is none.
-
getLastElementChild
Gets the DOMElement that is the last child of this ParentNode.- Returns:
- the DOMElement that is the last child of this ParentNode, or null if there is none.
-
getChildElementCount
public int getChildElementCount()Gets the number of child nodes of type Element that this parent node has.- Returns:
- the number of child nodes of type Element that this ParentNode has.
-
hasChildNodes
public boolean hasChildNodes()Description copied from interface:DOMNode
Does this node have any child nodes ?- Specified by:
hasChildNodes
in interfaceDOMNode
- Specified by:
hasChildNodes
in interfaceNode
- Returns:
true
if this node has child nodes,false
otherwise.
-
getPreviousElementSibling
Description copied from interface:NonDocumentTypeChildNode
Gets the first preceding sibling that is an element.- Specified by:
getPreviousElementSibling
in interfaceNonDocumentTypeChildNode
- Returns:
- the first preceding sibling that is an element, and
null
otherwise.
-
getNextElementSibling
Description copied from interface:NonDocumentTypeChildNode
Gets the first following sibling that is an element.- Specified by:
getNextElementSibling
in interfaceNonDocumentTypeChildNode
- Returns:
- the first following sibling that is an element, and
null
otherwise.
-
prependChild
- Throws:
DOMException
-
getNodeValue
- Specified by:
getNodeValue
in interfaceNode
- Throws:
DOMException
-
setNodeValue
- Specified by:
setNodeValue
in interfaceNode
- Throws:
DOMException
-
getNodeType
public short getNodeType()- Specified by:
getNodeType
in interfaceNode
-
getLocalName
Gives the local part of the qualified name of this node. For nodes of any type other thanELEMENT_NODE
andATTRIBUTE_NODE
, this is always null.- Specified by:
getLocalName
in interfaceNode
- Returns:
- the local part of the qualified name of this node, or null if this
node is not an
ELEMENT_NODE
nor anATTRIBUTE_NODE
.
-
getAttributes
- Specified by:
getAttributes
in interfaceNode
-
hasAttributes
public boolean hasAttributes()- Specified by:
hasAttributes
in interfaceNode
-
getChildNodes
Description copied from interface:DOMNode
Get the children of this node.- Specified by:
getChildNodes
in interfaceDOMNode
- Specified by:
getChildNodes
in interfaceNode
- Returns:
- a
DOMNodeList
with the children of this node. If there are no children, an empty list is returned.
-
getFirstChild
Description copied from interface:DOMNode
Get the first child of this node.- Specified by:
getFirstChild
in interfaceDOMNode
- Specified by:
getFirstChild
in interfaceNode
- Returns:
- the first child of this node,
null
if has no child nodes.
-
getLastChild
Description copied from interface:DOMNode
Get the last child of this node.- Specified by:
getLastChild
in interfaceDOMNode
- Specified by:
getLastChild
in interfaceNode
- Returns:
- the last child of this node,
null
if has no child nodes.
-
getPreviousSibling
Description copied from interface:DOMNode
Get the node immediately preceding this node in its parent's child list.- Specified by:
getPreviousSibling
in interfaceDOMNode
- Specified by:
getPreviousSibling
in interfaceNode
- Returns:
- the node immediately preceding this node in the child list, or
null
if none.
-
getNextSibling
Description copied from interface:DOMNode
Get the node immediately following this node in its parent's child list.- Specified by:
getNextSibling
in interfaceDOMNode
- Specified by:
getNextSibling
in interfaceNode
- Returns:
- the node immediately following this node in the child list, or
null
if none.
-
appendChild
Description copied from interface:DOMNode
Adds the nodenewChild
to the end of the list of children of this node. If thenewChild
is already in the tree, it is first removed.- Specified by:
appendChild
in interfaceDOMNode
- Specified by:
appendChild
in interfaceNode
- Parameters:
newChild
- the node to append. If it is aDocumentFragment
object, the entire contents of the document fragment are moved into the child list of this node.- Returns:
- the appended node.
- Throws:
DOMException
- HIERARCHY_REQUEST_ERR: raised if this node is of a type that does not allow children of the type of thenewChild
node, or if the node to append is one of this node's ancestors or this node itself, or if this node is of typeDocument
and the DOM application attempts to append a secondDocumentType
orElement
node.
WRONG_DOCUMENT_ERR: ifnewChild
was created from a different document than the one that created this node.
NOT_SUPPORTED_ERR: if this implementation does not support children of the type ofnewChild
at this node.
-
removeChild
Description copied from interface:DOMNode
Removes the nodeoldChild
from the children of this node.- Specified by:
removeChild
in interfaceDOMNode
- Specified by:
removeChild
in interfaceNode
- Parameters:
oldChild
- the node to remove.- Returns:
- the removed node.
- Throws:
DOMException
- NOT_FOUND_ERR: ifoldChild
is not a child of this node.
-
setUserData
- Specified by:
setUserData
in interfaceNode
-
getUserData
- Specified by:
getUserData
in interfaceNode
-
normalize
public void normalize() -
getFeature
Deprecated.This method is deprecated and not supported.- Specified by:
getFeature
in interfaceNode
- Parameters:
feature
- ignored.version
- ignored.- Returns:
null
.
-
isSupported
Deprecated.This method is not supported.- Specified by:
isSupported
in interfaceNode
- Parameters:
feature
- ignored.version
- ignored.- Returns:
- Always
true
.
-
compareDocumentPosition
- Specified by:
compareDocumentPosition
in interfaceNode
- Throws:
DOMException
-
getTextContent
- Specified by:
getTextContent
in interfaceNode
- Throws:
DOMException
-
setTextContent
- Specified by:
setTextContent
in interfaceNode
- Throws:
DOMException
-
getNamespaceURI
- Specified by:
getNamespaceURI
in interfaceNode
-
getPrefix
-
setPrefix
- Specified by:
setPrefix
in interfaceNode
- Throws:
DOMException
-
isEqualNode
- Specified by:
isEqualNode
in interfaceNode
-
isSameNode
- Specified by:
isSameNode
in interfaceNode
-
contains
Test ifnode
is an inclusive descendant of this node.- Parameters:
node
- the node to test.- Returns:
true
ifnode
is an inclusive descendant of this node,false
otherwise (includingnode
beingnull
).
-