@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.Flags
ATTRIBUTE_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_NODE
EventMap
PropertyChanged, 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, toString
addEventListener, addEventListener, addEventListener, addEventListener, dispatchEvent, dispose, removeEventListener, removeEventListener, removeEventListener
fireNotifyPropertyChanged, getCurrentValues, getRuntimesBinding, setCurrentValues, setField, setRuntimesBinding
public 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 Node
public int getNodeType()
A code representing the type of the underlying object.
Value: The type of the node.getNodeType
in class Node
public 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 Node
public 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 Node
public HTMLCollection getChildren()
Returns the child elements of current element.
Value: The children collectiongetChildren
in interface IParentNode
public 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 IParentNode
getFirstElementChild
in interface IElementTraversal
public 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 IParentNode
getLastElementChild
in interface IElementTraversal
public 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 IElementTraversal
public 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 IElementTraversal
public 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 IParentNode
getChildElementCount
in interface IElementTraversal
public Element querySelector(java.lang.String selector)
Returns the first Element in document, which match selector
querySelector
in interface IParentNode
selector
- The selector.public NodeList querySelectorAll(java.lang.String selector)
Returns a NodeList of all the Elements in document, which match selector
querySelectorAll
in interface IParentNode
selector
- The selectorHTMLCollection