Documents
@loaders.gl/documents loads XML, HTML, JSON, YAML, TOML, BSON, and a simple Markdown subset.
All document parsers are maintained in this repository. XML uses the native SAX implementation;
no third-party XML or JSON parser is installed by this package.
npm install @loaders.gl/core @loaders.gl/documents
The root exports metadata loaders, format descriptors, and shared types. It does not eagerly load parsers, XML dependencies, BSON codecs, or writers. Async core APIs preload implementations:
import {load} from '@loaders.gl/core';
import {MarkdownLoader} from '@loaders.gl/documents';
const document = await load('README.md', MarkdownLoader);
| Logo | Format | Metadata loader | Parser import | Output |
|---|---|---|---|---|
| — | XML | XMLLoader | @loaders.gl/documents/xml | JavaScript object |
| — | HTML | HTMLLoader | @loaders.gl/documents/html | XML-style object |
![]() | JSON | JSONLoader | @loaders.gl/documents/json | Any JSON value, without table extraction |
| YAML | YAMLLoader | @loaders.gl/documents/yaml | Objects, arrays, scalars | |
| TOML | TOMLLoader | @loaders.gl/documents/toml | JavaScript object | |
![]() | BSON | BSONLoader | @loaders.gl/documents/bson | JavaScript object |
| — | Markdown | MarkdownLoader | @loaders.gl/documents/markdown | MarkdownDocument syntax tree |
Each parser subpath exports the corresponding *LoaderWithParser. Use it for sync parsing:
import {parseSync} from '@loaders.gl/core';
import {MarkdownLoaderWithParser} from '@loaders.gl/documents/markdown';
const document = parseSync('# Hello', MarkdownLoaderWithParser);
BSON and Parquet
@loaders.gl/documents/bson-codec exports encodeBSONSync, parseBSONSync, BSONObjectId,
and createBSONValue. Import BSONWriter from @loaders.gl/documents/bson.
The codec preserves the existing BSON wire behavior and Parquet BSON logical-type read/write
support. It does not install the MongoDB bson package. See the BSON reference.
XML utilities
Use /xml-parser for parseXMLSync and validateXML, /sax-parser for SAXParser, and /xml-utils for
convertXMLFieldToArrayInPlace, convertXMLValueToArray, and the existing experimental
uncapitalization helpers. Parser and utility entry points are direct subpaths, without format groups.
Migration and credits
This package replaces @loaders.gl/xml, @loaders.gl/config, and the tables BSON exports.
See the upgrade guide for import replacements and the
source and license inventory.
Native XML policies
XML is strict by default, with one root element, bounded nesting (default 256), safe own-property construction, predefined/numeric entity decoding, and no DTD or external-entity resolution. Options control attribute prefixes/grouping, namespace removal, text keys, scalar coercion, whitespace, and singleton arrays. See XMLLoader. HTMLLoader uses the same implementation in a tolerant mode with built-in HTML entities; it remains an XML-style object reader, not an HTML5 DOM parser.
Package exports
All exported subpaths (18)
These are the package's public exports, including format entry points, parsers, writers, sources, and worker assets.

