@DOMObjectAttribute @DOMNameAttribute(name="DocumentFragment") public class DocumentFragment extends Node implements IParentNode
DocumentFragment is a "lightweight" or "minimal" Document object. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document.
Node.FlagsATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, flags, nodeDocument, NOTATION_NODE, parent, PROCESSING_INSTRUCTION_NODE, TEXT_NODEEventMapPropertyChanged, PropertyChangedDelegate| Constructor and Description |
|---|
DocumentFragment(Document ownerDocument)
Initializes a new instance of the
DocumentFragment class. |
| Modifier and Type | Method and Description |
|---|---|
int |
getChildElementCount()
Returns the current number of element nodes that are children of this element. 0 if this element has no child nodes that are of nodeType 1.
|
HTMLCollection |
getChildren()
Returns the child elements of current element.
|
Element |
getFirstElementChild()
Returns the first child element node of this element. null if this element has no child elements.
|
java.lang.String |
getInnerHTML()
Returns a fragment of HTML or XML that represents the element's contents.
|
Element |
getLastElementChild()
Returns the last child element node of this element. null if this element has no child elements.
|
Element |
getNextElementSibling()
Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.
|
java.lang.String |
getNodeName()
The name of this node, depending on its type.
|
int |
getNodeType()
A code representing the type of the underlying object.
|
java.lang.String |
getOuterHTML()
Returns a fragment of HTML or XML that represents the element and its contents.
|
Element |
getPreviousElementSibling()
Returns the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.
|
java.lang.String |
getTextContent()
This attribute returns the text content of this node and its descendants.
|
Element |
querySelector(java.lang.String selector)
Returns the first Element in document, which match selector
|
NodeList |
querySelectorAll(java.lang.String selector)
Returns a NodeList of all the Elements in document, which match selector
|
void |
setInnerHTML(java.lang.String value)
Returns a fragment of HTML or XML that represents the element's contents.
|
void |
setOuterHTML(java.lang.String value)
Returns a fragment of HTML or XML that represents the element and its contents.
|
void |
setTextContent(java.lang.String value)
This attribute returns the text content of this node and its descendants.
|
adoptNode, appendChild, cloneNode, deepClone, dispose, finalize, getAttributes, getBaseURI, getChildNodes, getChildNodesInternal, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getRegisteredObservers, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceAll, replaceChild, setLocalName, setNamespaceURI, setNodeValue, setParentNode, setPrefix, toStringaddEventListener, addEventListener, addEventListener, addEventListener, dispatchEvent, dispose, removeEventListener, removeEventListener, removeEventListenerfireNotifyPropertyChanged, getCurrentValues, getRuntimesBinding, setCurrentValues, setField, setRuntimesBindingpublic DocumentFragment(Document ownerDocument)
Initializes a new instance of the DocumentFragment class.
ownerDocument - The owner document.public java.lang.String getNodeName()
The name of this node, depending on its type.
Value: The name of the node.getNodeName in class Nodepublic int getNodeType()
A code representing the type of the underlying object.
Value: The type of the node.getNodeType in class Nodepublic java.lang.String getInnerHTML()
Returns a fragment of HTML or XML that represents the element's contents. Can be set, to replace the contents of the element with nodes parsed from the given string.
Value: The inner HTML.public void setInnerHTML(java.lang.String value)
Returns a fragment of HTML or XML that represents the element's contents. Can be set, to replace the contents of the element with nodes parsed from the given string.
Value: The inner HTML.public java.lang.String getOuterHTML()
Returns a fragment of HTML or XML that represents the element and its contents. Can be set, to replace the element with nodes parsed from the given string.
Value: The outer HTML.public void setOuterHTML(java.lang.String value)
Returns a fragment of HTML or XML that represents the element and its contents. Can be set, to replace the element with nodes parsed from the given string.
Value: The outer HTML.public java.lang.String getTextContent()
This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.
Value: The content of the text.getTextContent in class Nodepublic void setTextContent(java.lang.String value)
This attribute returns the text content of this node and its descendants. When it is defined to be null, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or null, replaced by a single Text node containing the string this attribute is set to.
Value: The content of the text.setTextContent in class Nodepublic HTMLCollection getChildren()
Returns the child elements of current element.
Value: The children collectiongetChildren in interface IParentNodepublic Element getFirstElementChild()
Returns the first child element node of this element. null if this element has no child elements.
Value: The first element child.getFirstElementChild in interface IParentNodegetFirstElementChild in interface IElementTraversalpublic Element getLastElementChild()
Returns the last child element node of this element. null if this element has no child elements.
Value: The last element child.getLastElementChild in interface IParentNodegetLastElementChild in interface IElementTraversalpublic Element getPreviousElementSibling()
Returns the previous sibling element node of this element. null if this element has no element sibling nodes that come before this one in the document tree.
getPreviousElementSibling in interface IElementTraversalpublic Element getNextElementSibling()
Returns the next sibling element node of this element. null if this element has no element sibling nodes that come after this one in the document tree.
getNextElementSibling in interface IElementTraversalpublic int getChildElementCount()
Returns the current number of element nodes that are children of this element. 0 if this element has no child nodes that are of nodeType 1.
Value: The child element count.getChildElementCount in interface IParentNodegetChildElementCount in interface IElementTraversalpublic Element querySelector(java.lang.String selector)
Returns the first Element in document, which match selector
querySelector in interface IParentNodeselector - The selector.public NodeList querySelectorAll(java.lang.String selector)
Returns a NodeList of all the Elements in document, which match selector
querySelectorAll in interface IParentNodeselector - The selectorHTMLCollection