public class Document extends Element
Modifier and Type | Class and Description |
---|---|
static class |
Document.OutputSettings
A Document's output settings control the form of the text() and html() methods.
|
static class |
Document.QuirksMode |
Constructor and Description |
---|
Document(java.lang.String baseUri)
Create a new, empty Document.
|
Modifier and Type | Method and Description |
---|---|
Element |
body()
Accessor to the document's
body element. |
java.nio.charset.Charset |
charset()
Returns the charset used in this document.
|
void |
charset(java.nio.charset.Charset charset)
Sets the charset used in this document.
|
Document |
clone()
Create a stand-alone, deep copy of this node, and all of its children.
|
Element |
createElement(java.lang.String tagName)
Create a new ReactElement, with this document's base uri.
|
static Document |
createShell(java.lang.String baseUri)
Create a valid, empty shell of a document, suitable for adding more elements to.
|
Element |
head()
Accessor to the document's
head element. |
java.lang.String |
location()
Get the URL this Document was parsed from.
|
java.lang.String |
nodeName()
Get the node name of this node.
|
Document |
normalise()
Normalise the document.
|
java.lang.String |
outerHtml()
Get the outer HTML of this node.
|
Document.OutputSettings |
outputSettings()
Get the document's current output settings.
|
Document |
outputSettings(Document.OutputSettings outputSettings)
Set the document's output settings.
|
Document.QuirksMode |
quirksMode() |
Document |
quirksMode(Document.QuirksMode quirksMode) |
Element |
text(java.lang.String text)
Set the text of the
body of this document. |
java.lang.String |
title()
Get the string contents of the document's
title element. |
void |
title(java.lang.String title)
Set the document's
title element. |
boolean |
updateMetaCharsetElement()
Returns whether the element with charset information in this document is
updated on changes through
Document.charset(Charset) or not. |
void |
updateMetaCharsetElement(boolean update)
Sets whether the element with charset information in this document is
updated on changes through
Document.charset(Charset) or not. |
addClass, after, after, append, appendChild, appendElement, appendText, appendTo, attr, attr, attributes, baseUri, before, before, child, childNodeSize, children, className, classNames, classNames, cssSelector, data, dataNodes, dataset, doClone, doSetBaseUri, elementSiblingIndex, empty, ensureChildNodes, firstElementSibling, getAllElements, getElementById, getElementsByAttribute, getElementsByAttributeStarting, getElementsByAttributeValue, getElementsByAttributeValueContaining, getElementsByAttributeValueEnding, getElementsByAttributeValueMatching, getElementsByAttributeValueMatching, getElementsByAttributeValueNot, getElementsByAttributeValueStarting, getElementsByClass, getElementsByIndexEquals, getElementsByIndexGreaterThan, getElementsByIndexLessThan, getElementsByTag, getElementsContainingOwnText, getElementsContainingText, getElementsMatchingOwnText, getElementsMatchingOwnText, getElementsMatchingText, getElementsMatchingText, hasAttributes, hasClass, hasText, html, html, html, id, insertChildren, insertChildren, is, is, isBlock, lastElementSibling, nextElementSibling, ownText, parent, parents, prepend, prependChild, prependElement, prependText, previousElementSibling, removeClass, select, selectFirst, shallowClone, siblingElements, tag, tagName, tagName, text, textNodes, toggleClass, toString, val, val, wholeText, wrap
absUrl, addChildren, addChildren, attr, childNode, childNodes, childNodesAsArray, childNodesCopy, clearAttributes, equals, filter, hasAttr, hasParent, hasSameValue, indent, nextSibling, outerHtml, ownerDocument, parentNode, previousSibling, remove, removeAttr, removeChild, reparentChild, replaceChild, replaceWith, root, setBaseUri, setParentNode, setSiblingIndex, siblingIndex, siblingNodes, traverse, unwrap
public Document(java.lang.String baseUri)
baseUri
- base URI of documentJsoup.parse(java.lang.String, java.lang.String)
,
createShell(java.lang.String)
public static Document createShell(java.lang.String baseUri)
baseUri
- baseUri of documentpublic java.lang.String location()
public Element head()
head
element.head
public Element body()
body
element.body
public java.lang.String title()
title
element.public void title(java.lang.String title)
title
element. Updates the existing element, or adds title
to head
if
not presenttitle
- string to set as titlepublic Element createElement(java.lang.String tagName)
tagName
- element tag name (e.g. a
)public Document normalise()
public java.lang.String outerHtml()
Node
public Element text(java.lang.String text)
body
of this document. Any existing nodes within the body will be cleared.public java.lang.String nodeName()
Node
public void charset(java.nio.charset.Charset charset)
OutputSettings.charset(Charset)
but in addition it updates the
charset / encoding element within the document.
This enables
meta charset update
.
If there's no element with charset / encoding information yet it will be created. Obsolete charset / encoding definitions are removed!
Elements used:
charset
- CharsetupdateMetaCharsetElement(boolean)
,
Document.OutputSettings.charset(java.nio.charset.Charset)
public java.nio.charset.Charset charset()
Document.OutputSettings.charset()
.Document.OutputSettings.charset()
public void updateMetaCharsetElement(boolean update)
Document.charset(Charset)
or not.
If set to false (default) there are no elements modified.
update
- If true the element updated on charset
changes, false if notcharset(java.nio.charset.Charset)
public boolean updateMetaCharsetElement()
Document.charset(Charset)
or not.public Document clone()
Node
The cloned node may be adopted into another Document or node structure using Element.appendChild(org.jsoup.nodes.Node)
.
clone
in class Element
Node.shallowClone()
public Document.OutputSettings outputSettings()
public Document outputSettings(Document.OutputSettings outputSettings)
outputSettings
- new output settings.public Document.QuirksMode quirksMode()
public Document quirksMode(Document.QuirksMode quirksMode)