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.
Part 3 of Z39.88-2004 defines an XML ContextObject Format, identified as info:ofi/fmt:xml:xsd:ctx and constrained by a W3C XML Schema. It expresses the same abstract ContextObject as KEV but can also bundle several ContextObjects in one document, allows several ServiceTypes and Resolvers, and can carry metadata in any XML schema that has been registered, such as MARCXML or Dublin Core.
Document structure
- The optional wrapper
<ctx:context-objects>holds one or more<ctx:context-object>elements; a single<ctx:context-object>may also be the root. - Administrative data are attributes of
<ctx:context-object>:version(fixedZ39.88-2004),identifierandtimestamp, all optional. Character encoding is declared in the XML declaration, not by a ContextObject attribute. - Entity elements appear in this order:
referent(required),referring-entity,requester,service-type(repeatable),resolver(repeatable),referrer. - Inside each Entity, Descriptors appear in this order:
identifier,metadata-by-val(withformatandmetadata),metadata-by-ref(withformatandlocation),private-data.
XML Metadata Formats
XML metadata formats are named info:ofi/fmt:xml:xsd:<name>. The standard's initial set mirrors KEV (journal, book, dissertation, patent, sch_svc). SAP2 also includes OAI unqualified Dublin Core (info:ofi/fmt:xml:xsd:oai_dc) and MARCXML (info:ofi/fmt:xml:xsd:MARC21). Later registrations added MODS, ONIX for Books, ISO 20775 holdings and ISO 25577 MarcXchange. Each bibliographic format has its own schema, with authors grouped in an <authors> container; see Journal (XML).
Example
<?xml version="1.0" encoding="UTF-8"?>
<ctx:context-object
xmlns:ctx="info:ofi/fmt:xml:xsd:ctx"
version="Z39.88-2004"
timestamp="2024-03-15T12:00:00Z">
<ctx:referent>
<ctx:identifier>info:doi/10.1002/andp.19053221004</ctx:identifier>
<ctx:metadata-by-val>
<ctx:format>info:ofi/fmt:xml:xsd:journal</ctx:format>
<ctx:metadata>
<jnl:journal xmlns:jnl="info:ofi/fmt:xml:xsd:journal">
<jnl:authors>
<jnl:author>
<jnl:aulast>Einstein</jnl:aulast>
<jnl:aufirst>A.</jnl:aufirst>
</jnl:author>
</jnl:authors>
<jnl:atitle>Zur Elektrodynamik bewegter Körper</jnl:atitle>
<jnl:jtitle>Annalen der Physik</jnl:jtitle>
<jnl:date>1905</jnl:date>
<jnl:volume>322</jnl:volume>
<jnl:issue>10</jnl:issue>
<jnl:spage>891</jnl:spage>
<jnl:epage>921</jnl:epage>
<jnl:genre>article</jnl:genre>
</jnl: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>
Element order matters because the schemas use xs:sequence: in the journal schema, authors comes first and genre last.
How XML travels
- By-Reference transport:
url_ctx_fmt=info:ofi/fmt:xml:xsd:ctxandurl_ctx_ref=the document's URL. - By-Value transport: the XML document, URL-encoded, as the value of
url_ctx_val, usually sent with HTTP POST.
The Inline transport carries KEV only. The SAP2 profile record was corrected in April 2006 to remove Inline transports from profiles based on XML. See Transports.