XML technologies / JSON for XML professionals / Conversion and hybrid publishing pipelines
In real publishing systems, the most important question is rarely which format wins overall. What matters more is where information is needed and which system maintains it. An XML master, a JSON interface and JSON-LD on the website can be useful parts of the same architecture. The combination becomes problematic only when their roles and permissible information losses are undocumented.
Master format, exchange format and output view
An editorial master format must preserve all information needed for future editing and intended outputs. An API view, however, may deliberately contain only a selection. A search-result card, for example, needs a title, identifier and teaser, but not necessarily every footnote and index entry in the source chapter.
Editorial XML master
|
+--> XML validation and editorial rules
|
+--> XSLT / XQuery --> HTML publication
|
+--> XSLT / XQuery --> JSON API projection
| |
| +--> CMS / web application
|
+--> Metadata mapping --> JSON-LD descriptionThis architecture is a recommendation for the example publisher, not a requirement of the JSON standard. It preserves the XML collection where its document-oriented model is needed and produces JSON where consuming systems expect structured objects and lists.
The reverse direction is also possible: a CMS maintains content in a documented JSON component model. Suitable domain-specific XML is generated from it for book typesetting. However, the CMS model must already contain enough information. A plain bodyText field cannot reliably reveal afterwards which sequence of words originally represented a publication title or paragraph number.
Why generic converters cannot replace domain models
An automatic XML-to-JSON converter can define rules for element names, attributes and text values. This resolves the syntactic mapping. However, it does not automatically know which order matters to the domain, whether a repeatable element must be output as a list even when it occurs once, or whether an identifier references an external record.
Multiple elements of the same type with intervening text are a particularly difficult case. Grouping by element name can destroy their order. Representing them as an ordered array of node types can preserve it, but requires an explicitly defined grammar and suitable tools. The package’s restricted rich-text model demonstrates exactly this.
XML namespaces also require a decision. A JSON key dc:title alone does not preserve a namespace binding. A mapping can instead use expanded names, separate URI and local-name fields, or an agreed context. The appropriate approach depends on whether the goal is to reconstruct XML nodes or produce semantic statements. These are different objectives. [Q09] [Q07]
Four different meanings of round trip
A round-trip test must first define what should remain equal after the return journey. An identical file hash is a much stricter goal than an identical domain statement.
Verification level | Example of a permitted change | What must still be preserved |
|---|---|---|
Byte identity | None | Every byte, including indentation and character references |
Structural equality within the chosen model | Different JSON indentation or XML prefixes with correct bindings | Agreed structures, values, types and relevant ordering |
Domain equality | API projection contains only approved fields | The information promised for this use case |
RDF graph equality | Different JSON-LD compaction or RDF/XML notation | The same statements, allowing blank-node renaming where necessary |
The mixed-content example is checked within its narrow element and attribute profile. It does not claim a round trip for every XML document. The semantic example compares RDF graphs, not the order of properties in JSON-LD text. Both checks are useful but answer different questions.
Interfaces need a versioned agreement
Reliable data exchange documents at least the root type, required fields, list rules, null handling, numeric profiles, language and identifiers. It also covers the content model, schemas, business rules and the meaning of each transformation. This agreement should exist separately from an incidental example file.
In the package, $id identifies a schema. This URI is neither automatically the record identifier nor evidence that validation must download an external file. All definitions needed for the test are available locally. In production, a controlled resolver can map known schema identities to approved local resources.
{
"contentModel": "https://example.org/data2type/models/catalog/1",
"generatedAt": "2026-09-21T08:00:00Z",
"sourceId": "editorial-catalog",
"books": []
}This envelope object is an additional contract example and is not part of the small catalog schema used in the executable examples. It shows how model identity and provenance could be explicitly included. Merely adding version numbers does not prevent incompatible changes, however. Migration and backward compatibility need their own tests.
Orchestration and quality assurance
A pipeline can combine XML, JSON and other documents. XProc 3.0 accounts for different document and media types; this does not mean that every processor provides every required transformation without additional steps. The specific steps and extensions must suit the runtime environment. [Q33]
Regardless of the orchestration tool, the workflow should make the same boundaries visible:
Manuel Montero Pineda explains input
-> check syntax and resource limits
-> validate the content model
-> apply business rules
-> transform into an explicit target model
-> validate the target
-> render a human-readable preview
-> compare assertions and record provenanceA good-looking browser page does not prove completeness. Conversely, successful JSON Schema validation does not prove that a page is readable and correctly designed. The companion package therefore separates machine assertions from the visible preview and actual browser captures.