Skip to content

Standards and conformance ​

The standards exemplar implements, the parts it omits, how conformance is tested, and where its behaviour differs from the standards or from the JDK.

Standards implemented ​

StandardEdition or versionWhere it appliesGuide
XML1.0 fifth edition, 1.1 second editionEvery readerGetting started
Namespaces in XML1.0 third edition, 1.1 second editionEvery reader and writerNamespaces
XML BaseSecond editionBase URIs in readers, trees, resolvers and XIncludeResolvers and access
xml:id1.0Every readerDTDs and entities
DTD validationAs XML 1.0 and 1.1 define it@exemplarjs/validationValidating against a DTD
XInclude1.0 second edition@exemplarjs/xincludeXInclude
XPointer framework, element() scheme and shorthand pointers1.0The xpointer attribute in XIncludeXInclude
OASIS XML Catalogs1.1@exemplarjs/catalogCatalogs
DOM CoreLevel 3@exemplarjs/domBuilding and reading a DOM
Canonical XML1.0 and 1.1@exemplarjs/canonicalCanonical XML
Exclusive XML Canonicalization1.0@exemplarjs/canonicalCanonical XML
XQuery and XPath Data Model3.1@exemplarjs/xdmThe XDM tree
XPath3.1@exemplarjs/xpathGetting started with XPath
XPath and XQuery Functions and Operators3.1The XPath functionsGetting started with XPath
XSLT and XQuery Serialization3.1serialize in XPathSerializing results

Coming from Java maps the names of Java's XML APIs to exemplar's.

Not implemented ​

  • XML Schema, RELAX NG and Schematron validation. In an XDM tree every element is xs:untyped and every attribute xs:untypedAtomic.
  • XSLT and XQuery. The XPath functions transform and load-xquery-module raise an error.
  • XPath 1.0 compatibility mode.
  • XPointer schemes other than element(), such as xpointer().
  • The <?oasis-xml-catalog?> processing instruction.
  • DOM mutation events, and the newer browser DOM additions such as append() and children. remove() is implemented.
  • DOM Level 3 configuration parameters that require a schema: datatype-normalization, validate and validate-if-schema.
  • Canonicalizing a document subset selected by an XPath expression, and canonicalizing XML 1.1 documents.
  • The parts of the XPath function library listed under Not available or limited.

How a document with a DTD is treated ​

ReaderWhat it does
Without a validator, the defaultParses the internal DTD subset, applies its attribute defaults and entity declarations, and does not validate
With dtdValidator()Also reports each validity error to the error handler
Either, when an external DTD or entity is not readContinues with the declarations already read
canonicalizeFails with C14N_UNREAD when it cannot read the DTD or an entity

See DTDs and entities.

How conformance is tested ​

TestCovers
The packages' own tests, on Node and in Chromium, Firefox, WebKitEvery package
W3C XML Conformance Test Suite, on NodeReading
W3C XInclude, xml:id and DOM test suitesXInclude, xml:id, the DOM
The examples in the Canonical XML recommendationsCanonical XML

Known differences from the standards ​

AreaDifference
upper-case, lower-caseUse the runtime's Unicode case data, character by character, with no context rules such as the Greek final sigma
Regular expressionsA back-reference under the i flag compares by JavaScript's case folding, which differs for a few characters
Regular expressionsA group inside a repeated group is reset on each repetition
Unicode collationsAre implemented with the runtime's Intl.Collator, so ordering follows the runtime's collation data; options it cannot honour are approximated
parse-jsonParses strict JSON only, regardless of the liberal option

Known differences from the JDK ​

AreaThe JDKexemplar
NamesChecks XML 1.0 names by the older, narrower character classesChecks by the fifth edition, which allows more characters
LocationsReports where an event endsReports where it starts
External accessAllows every protocol unless restrictedAllows none unless it is listed; a resolver or catalog then supplies the content
Catalogs: delegationUses only the delegated catalog with the longest match, and continues to other catalogs when it finds no matchSearches every matching delegated catalog, and stops when none of them matches
Catalogs: prefer on a groupCannot override the catalog's own prefer="system"Can override it
Catalogs: other namespacesIgnores every later entry after an element in another namespaceIgnores only that element and its content
Catalogs: relative xml:baseRejects itResolves it
Catalogs: unknown elements, entries missing an attributeFailsIgnores them
Catalogs: relative referencesTries them only as writtenTries them as written, then made absolute
Writer: empty elementsWrites <a></a> after writeStartElement and writeEndElementWrites <a/>

See Coming from Java for the differences in the API itself.

Released under the Apache License 2.0.