Skip to content

Packages and runtimes ​

Every package and entry point, with its exports, its peer dependencies and the runtimes it supports. Getting started shows the install commands.

Packages ​

PackageWhat it hasNeeds beside itGuide
@exemplarjs/xmlXMLInputFactory, the cursor and event readers, the error classes and the built-in decodersNothingGetting started
@exemplarjs/saxThe SAX parser, its handler types and XMLFilterImpl@exemplarjs/xmlHandling events with SAX
@exemplarjs/domThe DOM tree, DocumentBuilder, DOMParser and XMLSerializer@exemplarjs/xml, @exemplarjs/writerBuilding and reading a DOM
@exemplarjs/xdmThe XDM tree that XPath evaluates over, XdmDocumentBuilder and the value classes@exemplarjs/xmlThe XDM tree
@exemplarjs/xpathThe XPath 3.1 compiler@exemplarjs/xml, @exemplarjs/xdm, @exemplarjs/writerGetting started with XPath
@exemplarjs/writerThe stream and event writers, and the sinks they write to@exemplarjs/xmlWriting XML
@exemplarjs/validationdtdValidator(), for the validator option@exemplarjs/xmlValidating against a DTD
@exemplarjs/xincludexincludeProcessor(), for the xinclude option@exemplarjs/xmlXInclude
@exemplarjs/catalogcatalogResolver(), for the catalog option@exemplarjs/xmlCatalogs
@exemplarjs/canonicalcanonicalize() and canonicalizeAsync()@exemplarjs/xmlCanonical XML
@exemplarjs/encodings-cjkcjkDecoders, for Japanese, Chinese and Korean encodings@exemplarjs/xmlEncodings

Entry points ​

Some packages have several entry points, so that unused code is never loaded.

ImportWhat it hasGuide
@exemplarjs/xmlXMLInputFactory, EventType, XMLError, ErrorCode, InvalidArgumentError, IllegalStateError, AsyncReaderRequiredError, ResolutionError, QName, XMLEventFactory, DEFAULT_LIMITS, XML_NAMESPACE, XMLNS_NAMESPACEFactories and sources
@exemplarjs/xml/filterscreateFilteredReader, createDelegatedReader, StreamReaderDelegateDropping content with filters
@exemplarjs/xml/resolversfetchResolverResolvers and access
@exemplarjs/xml/resolvers/filefileResolverResolvers and access
@exemplarjs/xpathXPathCompiler with every function, XPathException, XPathErrorCode, PromiseNotAwaitedError, collectionMapGetting started with XPath
@exemplarjs/xpath/leanXPathCompiler with the core functions only, and the other names of @exemplarjs/xpathSmaller bundles
@exemplarjs/xpath/groups/<name>One function group for the lean compiler; see XPath functionsSmaller bundles
@exemplarjs/xpath/resolvers/directorydirectoryCollectionsReading documents and collections

InvalidArgumentError and IllegalStateError are also exported by each package that throws them, so they can be imported from the package already in use. Decimal, with Decimal.from(text) and Decimal.parse(text), is exported by @exemplarjs/xdm.

The internal entry points of @exemplarjs/xml, @exemplarjs/xdm and @exemplarjs/xpath are reserved for the other exemplar packages and may change in any release.

Runtimes ​

Everything runs on Node, Deno, Bun and modern browsers, and uses only web-standard APIs, with these exceptions.

ImportRuns onWhy
@exemplarjs/xml/resolvers/fileNode, Deno, BunReads files
@exemplarjs/xpath/resolvers/directoryNode, Deno, BunLists a directory
@exemplarjs/catalog with its default readNode, Deno, BunReads catalog files; supply a read function in a browser

The packages are ES modules with TypeScript declarations included.

Every package is declared free of side effects, so a bundler removes the modules an application does not import. Smaller bundles covers the XPath function groups.

Versions ​

All packages are released together under one version number. Each declares the others it uses as peer dependencies, so an application installs a single copy of each.

WARNING

Install every @exemplarjs package at the same version. The packages share internals, and two different versions of @exemplarjs/xml in one application do not work together.

Released under the Apache License 2.0.