-
public class FeaturedDocumentThe featured document.
A "featured document" is "very important" and all its features are calculated.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classFeaturedDocument.Companion
-
Field Summary
Fields Modifier and Type Field Description private final DocumentFragmentsfragmentsprivate final DocumentdocumentOrNullprivate final Integersequenceprivate final Stringtitleprivate final StringbaseUriprivate final Stringlocationprivate final Elementheadprivate final Elementbodyprivate final Stringtextprivate final StringownTextprivate final StringwholeTextprivate final Stringhtmlprivate final StringouterHtmlprivate final Charsetcharsetprivate final StringnodeNameprivate final Stringdataprivate final Stringidprivate final StringclassNameprivate final StringprettyHtmlprivate RealVectorfeaturesprivate final Documentdocument
-
Constructor Summary
Constructors Constructor Description FeaturedDocument(String baseUri)FeaturedDocument(FeaturedDocument other)FeaturedDocument(Document document)
-
Method Summary
Modifier and Type Method Description final DocumentFragmentsgetFragments()final DocumentgetDocumentOrNull()final IntegergetSequence()The process scope unique sequence. final StringgetTitle()final StringgetBaseUri()final StringgetLocation()final ElementgetHead()final ElementgetBody()final StringgetText()final StringgetOwnText()final StringgetWholeText()final StringgetHtml()final StringgetOuterHtml()final CharsetgetCharset()final StringgetNodeName()final StringgetData()final StringgetId()final StringgetClassName()final StringgetPrettyHtml()final RealVectorgetFeatures()final UnitsetFeatures(RealVector features)final DocumentgetDocument()final Documentunbox()final BooleanisNil()final BooleanisInternal()final BooleanisNotInternal()final ElementcreateElement(String tagName)final StringguessTitle()The title should be guessed for some site without a <title> tag inside a <head> tag final UnitabsoluteLinks()Make all links in the document to be absolute. final Elementsselect(String query, Integer offset, Integer limit)Find elements that match the CSS query, with the document as the starting context. final Elementsselect(String query, Integer offset)Find elements that match the CSS query, with the document as the starting context. final Elementsselect(String query)Find elements that match the CSS query, with the document as the starting context. final <T extends Any> List<T>select(String query, Integer offset, Integer limit, Function1<Element, T> transformer)Find elements that match the CSS query, with the document as the starting context. final ElementselectFirst(String query)Find the first element that match the CSS query, with the document as the starting context. final <T extends Any> TselectFirst(String query, Function1<Element, T> transformer)Find the first element that match the CSS query, with the document as the starting context. final ElementselectFirstOrNull(String query)Find the first element that match the CSS query, with the document as the starting context. final <T extends Any> TselectFirstOrNull(String query, Function1<Element, T> transformer)Find the first element that match the CSS query, with the document as the starting context. final Optional<Element>selectFirstOptional(String query)Find elements that match the CSS query, with the document as the starting context. final <T extends Any> Optional<T>selectFirstOptional(String query, Function1<Element, T> transformer)Find elements that match the CSS query, with the document as the starting context. final List<Hyperlink>selectHyperlinks(String query, Integer offset, Integer limit)Find hyperlinks in elements that match the CSS query, with the document as the starting context. final List<Hyperlink>selectHyperlinks(String query, Integer offset)Find hyperlinks in elements that match the CSS query, with the document as the starting context. final List<Hyperlink>selectHyperlinks(String query)Find hyperlinks in elements that match the CSS query, with the document as the starting context. final Elementfirst(String query)final <T extends Any> Tfirst(String query, Function1<Element, T> transformer)final StringfirstText(String query)Find the text content of the first element that match the CSS query, with the document as the starting context. final StringfirstTextOrNull(String query)Find the text content of the first element that match the CSS query, with the document as the starting context. final Optional<String>firstTextOptional(String query)Find the text content of the first element that match the CSS query, with the document as the starting context. final StringfirstAttribute(String query, String attrName, String defaultValue)Find the attribute value of the first element that match the CSS query, with the document as the starting context. final StringfirstAttributeOrNull(String query, String attrName)Find the attribute value of the first element that match the CSS query, with the document as the starting context. final Optional<String>firstAttributeOptional(String query, String attrName)Find the attribute value of the first element that match the CSS query, with the document as the starting context. final DoublegetFeature(Integer key)Retrieves the feature with the given key. final StringformatFeatures(Integer featureKeys)Format features. final StringformatNamedFeatures()Format named features. final UnitremoveAttrs(String attributeKeys)Remove attributes with the given keys. final UnitstripScripts()Remove all script nodes in the document. final UnitstripStyles()Remove all style nodes from the document, and remove all style attributes from all elements. final Pathexport()Export the document. final PathexportTo(Path path)Export the document to the given path. Booleanequals(Object other)IntegerhashCode()StringtoString()-
-
Constructor Detail
-
FeaturedDocument
FeaturedDocument(String baseUri)
-
FeaturedDocument
FeaturedDocument(FeaturedDocument other)
-
FeaturedDocument
FeaturedDocument(Document document)
-
-
Method Detail
-
getFragments
final DocumentFragments getFragments()
-
getDocumentOrNull
final Document getDocumentOrNull()
-
getSequence
final Integer getSequence()
The process scope unique sequence.
-
getBaseUri
final String getBaseUri()
-
getLocation
final String getLocation()
-
getHead
final Element getHead()
-
getBody
final Element getBody()
-
getOwnText
final String getOwnText()
-
getWholeText
final String getWholeText()
-
getOuterHtml
final String getOuterHtml()
-
getCharset
final Charset getCharset()
-
getNodeName
final String getNodeName()
-
getClassName
final String getClassName()
-
getPrettyHtml
final String getPrettyHtml()
-
getFeatures
final RealVector getFeatures()
-
setFeatures
final Unit setFeatures(RealVector features)
-
getDocument
final Document getDocument()
-
unbox
final Document unbox()
-
isInternal
final Boolean isInternal()
-
isNotInternal
final Boolean isNotInternal()
-
createElement
final Element createElement(String tagName)
-
guessTitle
final String guessTitle()
The title should be guessed for some site without a <title> tag inside a <head> tag
-
absoluteLinks
final Unit absoluteLinks()
Make all links in the document to be absolute.
-
select
@JvmOverloads() final Elements select(String query, Integer offset, Integer limit)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
select
@JvmOverloads() final Elements select(String query, Integer offset)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
select
@JvmOverloads() final Elements select(String query)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
select
final <T extends Any> List<T> select(String query, Integer offset, Integer limit, Function1<Element, T> transformer)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectFirst
final Element selectFirst(String query)
Find the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectFirst
final <T extends Any> T selectFirst(String query, Function1<Element, T> transformer)
Find the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectFirstOrNull
final Element selectFirstOrNull(String query)
Find the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectFirstOrNull
final <T extends Any> T selectFirstOrNull(String query, Function1<Element, T> transformer)
Find the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectFirstOptional
final Optional<Element> selectFirstOptional(String query)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>Return the first element, if no element matches the query, return an Optional object.
-
selectFirstOptional
final <T extends Any> Optional<T> selectFirstOptional(String query, Function1<Element, T> transformer)
Find elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>Return the first element, if no element matches the query, return an Optional object.
-
selectHyperlinks
@JvmOverloads() final List<Hyperlink> selectHyperlinks(String query, Integer offset, Integer limit)
Find hyperlinks in elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectHyperlinks
@JvmOverloads() final List<Hyperlink> selectHyperlinks(String query, Integer offset)
Find hyperlinks in elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
selectHyperlinks
@JvmOverloads() final List<Hyperlink> selectHyperlinks(String query)
Find hyperlinks in elements that match the CSS query, with the document as the starting context. Matched elements may include the document, or any of its children.
<p>This method is generally more powerful to use than the DOM-type {@code getElementBy*} methods, because multiple filters can be combined, e.g.:</p>
-
first
@Deprecated(message = Inappropriate name, replaceWith = @ReplaceWith(imports = {}, expression = selectFirst(query))) final Element first(String query)
-
first
@Deprecated(message = Inappropriate name, replaceWith = @ReplaceWith(imports = {}, expression = selectFirst(query, transformer))) final <T extends Any> T first(String query, Function1<Element, T> transformer)
-
firstText
final String firstText(String query)
Find the text content of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
firstTextOrNull
final String firstTextOrNull(String query)
Find the text content of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
firstTextOptional
final Optional<String> firstTextOptional(String query)
Find the text content of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
firstAttribute
final String firstAttribute(String query, String attrName, String defaultValue)
Find the attribute value of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
firstAttributeOrNull
final String firstAttributeOrNull(String query, String attrName)
Find the attribute value of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
firstAttributeOptional
final Optional<String> firstAttributeOptional(String query, String attrName)
Find the attribute value of the first element that match the CSS query, with the document as the starting context. Matched element may be the document, or any of its children.
-
getFeature
final Double getFeature(Integer key)
Retrieves the feature with the given key.
-
formatFeatures
final String formatFeatures(Integer featureKeys)
Format features.
-
formatNamedFeatures
final String formatNamedFeatures()
Format named features.
-
removeAttrs
final Unit removeAttrs(String attributeKeys)
Remove attributes with the given keys.
-
stripScripts
final Unit stripScripts()
Remove all script nodes in the document.
-
stripStyles
final Unit stripStyles()
Remove all style nodes from the document, and remove all style attributes from all elements.
-
-
-
-