Skip to main content

HTMLLoader

From-v3.4

 

BETA

The HTMLLoader parses HTML-encoded data.

The HTMLoader attempts to parse an HTML file as an XML file. It does not have any understanding of the structure of HTML or the document.

LoaderCharacteristic
File Extension.html, .htm
MIME Typetext/html
File TypeText
File FormateXtensible Markup Language
Data FormatFree format data structure
Decoder TypeSynchronous
Worker Thread SupportNo
Streaming SupportNo

The HTMLLoader is only expected to be fit-for-purpose for a few limited use cases. It is not intended for full fidelity parsing or display of HTML files. It is designed for minimal ad-hoc use cases such as

  • the extraction of an error string from an HTML formatted error response from a server
  • or possibly to extract some valuable information (perhaps the URL to a geospatial service) from a server that doesn't provide more structured return formats (such as JSON or XML).

Usage

import {HTMLLoader} from '@loaders.gl/xml';
import {load} from '@loaders.gl/core';

const data = await load(url, HTMLLoader, options);

Data Format

Unstructured, untyped data in the form a tree of JavaScrip objects representing the hierarchy of tags in the HTML file.

Options

For options, see the XMLLoader.

OptionTypeDefaultDescription

Attributions

The HTMLLoader is a wrapper around fast-xml-parser.