HTML Text Extractor

Extract lexical HTML text while excluding script and style contents, decoding numeric and common syntax references, and preserving unknown named references.

Description

HTML source text differs from browser-rendered text.

HTML source text differs from browser-rendered text. This lexical extractor joins text tokens while excluding script/style content and decoding a small reference set.1

The returned values include Extracted text without presentation layout. The How section below explains the calculation, input rules and interpretation.

When to use HTML Text Extractor

Use HTML Text Extractor when you need to evaluate the supplied records under the calculation and evidence rules below. No DOM repair, CSS visibility, layout whitespace or complete HTML character-reference decoding occurs. Adjacent block text is joined without inserted separators.

Paste the requested source HTML or single start tag. Decide whether lexical source information meets your task before interpreting its output.

How to use HTML Text Extractor and understand its results

  1. Paste the requested source HTML or single start tag. Decide whether lexical source information meets your task before interpreting its output.
  2. Enter html using the field table and calculation rules, then run the tool.
  3. Read text. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
htmlHTML source.string; maximum length: 1000000Required

Paste source HTML. Use the shared quote-aware tag scanner; exclude comments, declarations, markup and script/style contents. Decode semicolon-terminated amp/lt/gt/quot/apos/nbsp and decimal or lowercase-x hexadecimal numeric references. Replace zero, surrogate or out-of-range numeric code points with the replacement character. Keep unknown named references unchanged.2, 3

text=join decoded visible text tokens

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
textExtracted text without presentation layout.string; maximum length: 1000000
json
{
  "input": {
    "html": "<p>Tom &amp; Jerry &#x1F600;</p><script>secret()</script>"
  },
  "output": {
    "text": "Tom & Jerry 😀"
  }
}

Limitations and assumptions

No DOM repair, CSS visibility, layout whitespace or complete HTML character-reference decoding occurs. Adjacent block text is joined without inserted separators.

Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing fields without a declared default, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use HTML Tag Counter: Start-tag counts measure lexical markup occurrences rather than the number of browser DOM elements. Comments and raw-text contents should not count as tags. For a complementary task, use HTML Attribute Parser: An HTML start tag has a name and attributes whose lexical spelling can differ from browser-decoded values. Duplicate attributes require an explicit retention rule.

References

  1. HTML Text Extractor — tool.io

  2. HTML Tag Counter — tool.io

  3. HTML Attribute Parser — tool.io

Similar or alternative tools

  • HTML Tag Counter

    Start-tag counts measure lexical markup occurrences rather than the number of browser DOM elements. Comments and raw-text contents should not count as tags.

  • HTML Attribute Parser

    An HTML start tag has a name and attributes whose lexical spelling can differ from browser-decoded values. Duplicate attributes require an explicit retention rule.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies