Skip to main content

Documents · XML

Keep document parsing separate from document meaning.

@loaders.gl/documents provides the XML parsing boundary used by format-specific loaders. It exposes XML document processing without forcing applications to depend on one particular geographic, media, or metadata vocabulary.

Structured data boundaries

Keep the source shape. Choose the application shape.

JSON, delimited text, BSON, and XML describe data differently. loaders.gl keeps those input boundaries explicit while letting applications choose documents, tables, features, or trees for the next stage.

Common API boundary

documentbatchstream

load · parse · write

Application results

Documentnested objects and arrays
Tablerows, columns, or Arrow batches
Featuresgeometry plus properties
Treeformat-specific document structure

A readable interchange format can stay readable at the edge, or become a typed table when that is what the application needs.

The document parsing path

Read XML tokens. Let the format loader interpret them.

XML is a syntax layer shared by formats such as KML and other document types. This module handles that layer so higher-level loaders can focus on their own data models.

Input

XML or HTML text and binary resources

Parsing

Token and document structure

Consumers

KML, metadata, and application loaders

Output

Format-specific JavaScript data

Detailed guide

Parser and format details

The reference below covers XML handling, HTML support, installation, parser behavior, and attribution.

From-v3.3

The @loaders.gl/documents module handles the eXtensible Markup Language format.

APIs​

  • XMLLoader parses XML into JavaScript values.
  • HTMLLoader handles HTML input.
  • parseXMLSync provides direct synchronous XML parsing.
  • SAXParser exposes the underlying event-based parser.

The module parses document structure. Protocol-specific interpretation belongs to loaders such as KML and WMS. See the XML format page.

Installation​

npm install @loaders.gl/documents
npm install @loaders.gl/core

Attribution​

This module contains a fork of sax-ts, which is in turn is a TypeScript fork of Isaac Schlueter's sax-js, both licensed under the MIT-compatible ISC license.

Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Sources and credits​

See the package source and license inventory and the project-wide Attributions and Credits.