Package org.htmlunit.html.serializer
Class HtmlSerializerNormalizedText
- java.lang.Object
-
- org.htmlunit.html.serializer.HtmlSerializerNormalizedText
-
public class HtmlSerializerNormalizedText extends java.lang.Object
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 Classes Modifier and Type Class Description protected static class
HtmlSerializerNormalizedText.HtmlSerializerTextBuilder
-
Field Summary
Fields Modifier and Type Field Description private boolean
ignoreMaskedElements_
-
Constructor Summary
Constructors Constructor Description HtmlSerializerNormalizedText()
-
Method Summary
-
-
-
Method Detail
-
asText
public java.lang.String asText(DomNode node)
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, java.util.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
private boolean isVisible(DomNode node)
-
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
-
-