I · 08
The XML Format
The XML serialization writes a ContextObject as a structured document, typically used By-Reference when an OpenURL points to an externally-stored description.
Z39.88-2004 defines an XML serialization of the ContextObject as a counterpart to the KEV format. The XML form expresses the same abstract object as KEV; conversion between the two is round-trippable. The XML form is most commonly used in conjunction with the By-Reference transport: a URL points to an XML ContextObject hosted elsewhere, and the resolver fetches and parses it.
Document structure
An XML ContextObject is rooted at a <context-object> element in the OpenURL namespace. The root element carries administrative attributes corresponding to the ctx_* keys in KEV: a version (the only registered value is Z39.88-2004), an optional identifier, an optional timestamp, and an optional encoding declaration.
Inside <context-object> one or more entity elements describe the entities: a Referent (required), and any of Referrer, ReferringEntity, Requester, ServiceType, Resolver (optional).
Format identifiers
The XML metadata formats are named by URIs of the form info:ofi/fmt:xml:xsd:<type>. The four registered XML formats parallel the four KEV formats:
info:ofi/fmt:xml:xsd:journal— journal articles and journalsinfo:ofi/fmt:xml:xsd:book— books and chaptersinfo:ofi/fmt:xml:xsd:dissertation— dissertationsinfo:ofi/fmt:xml:xsd:patent— patents
Each format is published as an XML Schema (XSD).
Example
A minimal XML ContextObject describing a journal article looks like this. Namespace declarations are abbreviated for clarity; the standard prescribes the exact URIs.
<?xml version="1.0" encoding="UTF-8"?>
<ctx:context-object
xmlns:ctx="info:ofi/fmt:xml:xsd:ctx"
xmlns:journal="info:ofi/fmt:xml:xsd:journal"
version="Z39.88-2004"
timestamp="2024-03-15T12:00:00Z">
<ctx:referent>
<ctx:metadata-by-val>
<ctx:format>info:ofi/fmt:xml:xsd:journal</ctx:format>
<ctx:metadata>
<journal:journal>
<journal:genre>article</journal:genre>
<journal:atitle>On the Electrodynamics of Moving Bodies</journal:atitle>
<journal:jtitle>Annalen der Physik</journal:jtitle>
<journal:aulast>Einstein</journal:aulast>
<journal:aufirst>A.</journal:aufirst>
<journal:date>1905</journal:date>
<journal:volume>322</journal:volume>
<journal:issue>10</journal:issue>
<journal:spage>891</journal:spage>
<journal:epage>921</journal:epage>
</journal:journal>
</ctx:metadata>
</ctx:metadata-by-val>
</ctx:referent>
<ctx:referrer>
<ctx:identifier>info:sid/example.com:database</ctx:identifier>
</ctx:referrer>
</ctx:context-object>
How XML appears in transit
An XML ContextObject can travel in either of two ways:
- By-Reference: the OpenURL is a KEV-form URL whose
rft_ref_fmtdeclares the formatinfo:ofi/fmt:xml:xsd:journal(or another XML format), andrft_refgives the URL where the XML document can be fetched. See Transports. - As a POST body: the entire XML ContextObject is sent as the body of an HTTP POST request to the resolver.
Inline transport — embedding XML in HTML pages — is not the typical mode; HTML embedding is generally done through KEV-based COinS.