Package org.htmlunit.html.serializer
Class HtmlSerializerNormalizedText
java.lang.Object
org.htmlunit.html.serializer.HtmlSerializerNormalizedText
Utility to handle conversion from HTML code to string.
This implements HtmlUnit's way of normalization.
Note: There conversation done by selenium WebElement#getText() is different.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendBreak
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlBreak htmlBreak) ProcessHtmlBreak
.protected void
appendCheckBoxInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlCheckBoxInput htmlCheckBoxInput) ProcessHtmlCheckBoxInput
.protected void
Iterate over all Children and call appendNode() for every.protected void
appendDetails
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlDetails htmlDetails) ProcessHtmlDetails
.protected void
appendDomNode
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomNode domNode) ProcessHtmlHiddenInput
.protected void
appendInlineFrame
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlInlineFrame htmlInlineFrame) ProcessHtmlInlineFrame
.protected void
appendInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlInput htmlInput) ProcessHtmlInput
.protected void
The core distribution method call the different appendXXX methods depending on the type of the given node.protected void
appendNumberInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlNumberInput htmlNumberInput) ProcessHtmlNumberInput
.protected void
appendOrderedList
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlOrderedList htmlOrderedList) ProcessHtmlOrderedList
taking care to numerate it.protected void
appendPreformattedText
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlPreformattedText htmlPreformattedText) ProcessHtmlPreformattedText
.protected void
appendRadioButtonInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlRadioButtonInput htmlRadioButtonInput) ProcessHtmlRadioButtonInput
.protected void
appendResetInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlResetInput htmlResetInput) ProcessHtmlResetInput
.protected void
appendSelect
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlSelect htmlSelect) ProcessHtmlSelect
.protected void
appendSubmitInput
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlSubmitInput htmlSubmitInput) ProcessHtmlSubmitInput
.protected void
appendTable
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTable htmlTable) ProcessHtmlTable
.protected void
appendTableRow
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTableRow htmlTableRow) ProcessHtmlTableRow
.protected boolean
appendTableRows
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, List<HtmlTableRow> rows, boolean first, TableRowGroup skipParent1, TableRowGroup skipParent2) ProcessHtmlTableRow
.protected void
appendText
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomText domText) ProcessDomText
.protected void
appendTextArea
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTextArea htmlTextArea) ProcessHtmlTextArea
.protected void
appendTitle
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTitle htmlTitle) ProcessHtmlTitle
.protected void
appendUnorderedList
(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlUnorderedList htmlUnorderedList) ProcessHtmlUnorderedList
.Converts an HTML node to text.private boolean
void
setIgnoreMaskedElements
(boolean ignore) Indicates if element that are not displayed due to style settings (visibility or display) should be visible in generated text.
-
Field Details
-
ignoreMaskedElements_
private boolean ignoreMaskedElements_
-
-
Constructor Details
-
HtmlSerializerNormalizedText
public HtmlSerializerNormalizedText()
-
-
Method Details
-
asText
Converts an HTML node to text.- Parameters:
node
- a node- Returns:
- the text representation according to the setting of this serializer
-
appendChildren
protected void appendChildren(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomNode node) Iterate over all Children and call appendNode() for every.- Parameters:
builder
- the StringBuilder to add tonode
- the node to process
-
appendNode
protected void appendNode(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomNode node) The core distribution method call the different appendXXX methods depending on the type of the given node.- Parameters:
builder
- the StringBuilder to add tonode
- the node to process
-
appendDomNode
protected void appendDomNode(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomNode domNode) ProcessHtmlHiddenInput
.- Parameters:
builder
- the StringBuilder to add todomNode
- the target to process
-
appendSubmitInput
protected void appendSubmitInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlSubmitInput htmlSubmitInput) ProcessHtmlSubmitInput
.- Parameters:
builder
- the StringBuilder to add tohtmlSubmitInput
- the target to process
-
appendInput
protected void appendInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlInput htmlInput) ProcessHtmlInput
.- Parameters:
builder
- the StringBuilder to add tohtmlInput
- the target to process
-
appendNumberInput
protected void appendNumberInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlNumberInput htmlNumberInput) ProcessHtmlNumberInput
.- Parameters:
builder
- the StringBuilder to add tohtmlNumberInput
- the target to process
-
appendResetInput
protected void appendResetInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlResetInput htmlResetInput) ProcessHtmlResetInput
.- Parameters:
builder
- the StringBuilder to add tohtmlResetInput
- the target to process
-
appendUnorderedList
protected void appendUnorderedList(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlUnorderedList htmlUnorderedList) ProcessHtmlUnorderedList
.- Parameters:
builder
- the StringBuilder to add tohtmlUnorderedList
- the target to process
-
appendDetails
protected void appendDetails(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlDetails htmlDetails) ProcessHtmlDetails
.- Parameters:
builder
- the StringBuilder to add tohtmlDetails
- the target to process
-
appendTitle
protected void appendTitle(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTitle htmlTitle) ProcessHtmlTitle
.- Parameters:
builder
- the StringBuilder to add tohtmlTitle
- the target to process
-
appendTableRow
protected void appendTableRow(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTableRow htmlTableRow) ProcessHtmlTableRow
.- Parameters:
builder
- the StringBuilder to add tohtmlTableRow
- the target to process
-
appendTextArea
protected void appendTextArea(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTextArea htmlTextArea) ProcessHtmlTextArea
.- Parameters:
builder
- the StringBuilder to add tohtmlTextArea
- the target to process
-
appendTable
protected void appendTable(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlTable htmlTable) ProcessHtmlTable
.- Parameters:
builder
- the StringBuilder to add tohtmlTable
- the target to process
-
appendTableRows
protected boolean appendTableRows(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, List<HtmlTableRow> rows, boolean first, TableRowGroup skipParent1, TableRowGroup skipParent2) ProcessHtmlTableRow
.- Parameters:
builder
- the StringBuilder to add torows
- the rowsfirst
- if true this is the first oneskipParent1
- skip row if the parent is thisskipParent2
- skip row if the parent is this- Returns:
- true if this was the first one
-
appendSelect
protected void appendSelect(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlSelect htmlSelect) ProcessHtmlSelect
.- Parameters:
builder
- the StringBuilder to add tohtmlSelect
- the target to process
-
appendOrderedList
protected void appendOrderedList(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlOrderedList htmlOrderedList) ProcessHtmlOrderedList
taking care to numerate it.- Parameters:
builder
- the StringBuilder to add tohtmlOrderedList
- the OL element
-
appendPreformattedText
protected void appendPreformattedText(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlPreformattedText htmlPreformattedText) ProcessHtmlPreformattedText
.- Parameters:
builder
- the StringBuilder to add tohtmlPreformattedText
- the target to process
-
appendInlineFrame
protected void appendInlineFrame(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlInlineFrame htmlInlineFrame) ProcessHtmlInlineFrame
.- Parameters:
builder
- the StringBuilder to add tohtmlInlineFrame
- the target to process
-
appendText
protected void appendText(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, DomText domText) ProcessDomText
.- Parameters:
builder
- the StringBuilder to add todomText
- the target to process
-
appendBreak
protected void appendBreak(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlBreak htmlBreak) ProcessHtmlBreak
.- Parameters:
builder
- the StringBuilder to add tohtmlBreak
- the target to process
-
appendCheckBoxInput
protected void appendCheckBoxInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlCheckBoxInput htmlCheckBoxInput) ProcessHtmlCheckBoxInput
.- Parameters:
builder
- the StringBuilder to add tohtmlCheckBoxInput
- the target to process
-
appendRadioButtonInput
protected void appendRadioButtonInput(HtmlSerializerNormalizedText.HtmlSerializerTextBuilder builder, HtmlRadioButtonInput htmlRadioButtonInput) ProcessHtmlRadioButtonInput
.- Parameters:
builder
- the StringBuilder to add tohtmlRadioButtonInput
- the target to process
-
isVisible
-
setIgnoreMaskedElements
public void setIgnoreMaskedElements(boolean ignore) Indicates if element that are not displayed due to style settings (visibility or display) should be visible in generated text.- Parameters:
ignore
- indicates if masked elements should be ignored or not
-