This document is also available in these non-normative formats: XML and HTML with automatic change markup courtesy of DeltaXignia.
Copyright © 2021–2026 the Contributors to the XProc 3.2: Data Format Description Language specification, published by the XProc Next Community Group under the W3C Community Contributor License Agreement (CLA). A human-readable summary is available.
This specification describes the p:dfdl-parse and p:dfdl-unparse
step for XProc 3.2: An XML Pipeline Language.
This document is an editor's draft that has no official standing.
This specification was published by the XProc Next Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more about W3C Community and Business Groups.
If you wish to make comments regarding this document, please send them to xproc-dev@w3.org. (subscribe, archives).
This draft is the “editor’s working draft” and may continue to evolve.
This specification describes the p:dfdl-parse and p:dfdl-unparse
XProc steps. A machine-readable description of these steps may be found in steps.xpl.
Familarity with the general nature of XProc 3.2 steps is assumed.
The p:dfdl-parse step performs Data Format Description Language parse per Data Format Description Language. It transforms a non-XML input into an infoset (e.g. XML) by applying
the specified DFDL schema.
Summary
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| schema | ✔ | any | |
| source | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | ✔ | any |
| Option name | Type | Default value |
|---|---|---|
| fail-on-error | xs:boolean | true() |
| infoset | xs:string | 'xml' |
| parameters | map(xs:QName,item()*)? | () |
| root | xs:QName | () |
| stream | xs:boolean | false() |
| variables | map(xs:QName, xs:string*)? | () |
| Error code | Description |
|---|---|
| err:XC0214 | It is a dynamic
error (err:XC0214) if the source document cannot be parsed by the provided schema. |
| err:XC0215 | It is a dynamic error (err:XC0215) if root
does not identify a top-level element declaration in the provided schema. |
| err:XC0216 | it is a dynamic
error (err:XC0216) for data to remain after parse. |
| Implementation | Description |
|---|---|
| Defined | It
is implementation-defined if serializations other than XML are supported on
the schema port. |
| Defined | It is implementation-defined
which additional infoset representations (for example, JSON) are
supported. |
| Defined | The parameters supported and their semantics are implementation-defined
.
|
| Defined | It is implementation-defined if a DFDL processor supports streaming. |
<p:declare-step type="p:dfdl-parse">
<p:input port="schema" sequence="true" content-types="any"/>
<p:input port="source" primary="true" content-types="any"/>
<p:output port="result" sequence="true" content-types="any"/>
<p:option name="fail-on-error" as="xs:boolean" select="true()"/>
<p:option name="infoset" as="xs:string" select="'xml'"/>
<p:option name="parameters" as="map(xs:QName,item()*)?"/>
<p:option name="root" as="xs:QName"/>
<p:option name="stream" as="xs:boolean" select="false()"/>
<p:option name="variables" as="map(xs:QName, xs:string*)?"/> </p:declare-step>
XProc processors must support a schema provided as XML. It
is implementation-defined if serializations other than XML are supported on
the schema port.
If fail-on-error is true, the step will raise an error
if the input cannot be parsed by the schema. It is a dynamic
error (err:XC0214) if the source document cannot be parsed by the provided schema.
If fail-on-error is false, no error will be raised and
processors may return implementation-defined diagnostics on result
.
The infoset specifies the desired content type of the infoset.
Processors must support the value xml. It is implementation-defined
which additional infoset representations (for example, JSON) are
supported.
The parameters supported and their semantics are implementation-defined
.
The variables stores external DFDL variables whose names are
specified by a xs:QName.
The root specifies the target top-level element in the schema to
start processing. By default, the first top-level element of the schema
will be used. It is a dynamic error (err:XC0215) if root
does not identify a top-level element declaration in the provided schema.
If stream is true, when the DFDL processor encounters
remaining data after parse, the parse operation repeats with the remaining data.
Processing repeats until end-of-data, a parse failure, or a parse consumes no additional
data. Each successful parse repetition produces a new document on result.
If stream is false, it is a dynamic
error (err:XC0216) for data to remain after parse.
It is implementation-defined
if a DFDL processor supports streaming.
No document properties are preserved.
The p:dfdl-unparse step performs Data Format Description Language unparse per Data Format Description Language. It transforms an infoset (for example, XML or JSON) into a non-XML data
stream by applying the specified DFDL schema.
Summary
| Input port | Primary | Sequence | Content types |
|---|---|---|---|
| schema | ✔ | any | |
| source | ✔ | ✔ | any |
| Output port | Primary | Sequence | Content types |
|---|---|---|---|
| result | ✔ | ✔ | any |
| Option name | Type | Default value |
|---|---|---|
| fail-on-error | xs:boolean | true() |
| infoset | xs:string | 'xml' |
| parameters | map(xs:QName,item()*)? | () |
| root | xs:QName? | () |
| stream | xs:boolean | false() |
| variables | map(xs:QName, xs:string*)? | () |
| Error code | Description |
|---|---|
| err:XC0217 | It is a dynamic
error (err:XC0217) if the source infoset cannot be unparsed by the provided schema. |
| err:XC0218 | It is a dynamic error (err:XC0218) if the
specified root does not identify a top-level element declaration in the
provided schema. |
| err:XC0219 | it is a dynamic
error (err:XC0219) for more than one document to appear on source. |
| Implementation | Description |
|---|---|
| Defined | It
is implementation-defined if serializations other than XML are supported on
the schema port. |
| Defined | It is implementation-defined
which additional infoset representations (for example, JSON) are
supported. |
| Defined | The parameters supported and their semantics are implementation-defined
. |
| Defined | It is implementation-defined if a DFDL processor supports streaming unparse. |
<p:declare-step type="p:dfdl-unparse">
<p:input port="schema" sequence="true" content-types="any"/>
<p:input port="source" primary="true" sequence="true" content-types="any"/>
<p:output port="result" sequence="true" content-types="any"/>
<p:option name="fail-on-error" as="xs:boolean" select="true()"/>
<p:option name="infoset" as="xs:string" select="'xml'"/>
<p:option name="parameters" as="map(xs:QName,item()*)?"/>
<p:option name="root" as="xs:QName?"/>
<p:option name="stream" as="xs:boolean" select="false()"/>
<p:option name="variables" as="map(xs:QName, xs:string*)?"/> </p:declare-step>
XProc processors must support a schema provided as XML. It
is implementation-defined if serializations other than XML are supported on
the schema port.
If fail-on-error is true, the step will raise an error
if the infoset cannot be unparsed by the schema. It is a dynamic
error (err:XC0217) if the source infoset cannot be unparsed by the provided schema.
If fail-on-error is false, no error will be raised and
processors may return implementation-defined diagnostics on result
or as out-of-band reports.
The infoset specifies the content type of the infoset on source.
Processors must support the value xml. It is implementation-defined
which additional infoset representations (for example, JSON) are
supported.
The parameters supported and their semantics are implementation-defined
.
The variables stores external DFDL variables whose names are
specified by a xs:QName.
The root specifies the target top-level element in the schema to
start processing. By default, the first top-level element of the schema
will be used. It is a dynamic error (err:XC0218) if the
specified root does not identify a top-level element declaration in the
provided schema.
If stream is true, each document on source
is unparsed independently and produces a corresponding document on result.
If stream is false, it is a dynamic
error (err:XC0219) for more than one document to appear on source. It
is implementation-defined if a DFDL processor supports streaming
unparse.
No document properties are preserved.
These steps can raise dynamic errors .
A dynamic error is one which occurs while a pipeline is being evaluated. Examples of dynamic errors include references to URIs that cannot be resolved, steps which fail, and pipelines that exhaust the capacity of an implementation (such as memory or disk space). For a more complete discussion of dynamic errors, see Dynamic Errors in XProc 3.2: An XML Pipeline Language.
If a step fails due to a dynamic error, failure propagates upwards until either a
p:try
is encountered or the entire pipeline fails. In other words, outside of a p:try,
step failure causes the entire pipeline to fail.
The following errors can be raised by these steps:
err:XC0214It is a dynamic error if the source document cannot be parsed by the provided schema.
See: p:dfdl-parse
err:XC0215It is a dynamic error if root does not identify a top-level element declaration in the provided schema.
See: p:dfdl-parse
err:XC0216it is a dynamic error for data to remain after parse.
See: p:dfdl-parse
err:XC0217It is a dynamic error if the source infoset cannot be unparsed by the provided schema.
See: p:dfdl-unparse
err:XC0218It is a dynamic error if the specified root does not identify a top-level element declaration in the provided schema.
See: p:dfdl-unparse
err:XC0219it is a dynamic error for more than one document to appear on source.
See: p:dfdl-unparse
Conformant processors must implement all of the features described in this specification except those that are explicitly identified as optional.
Some aspects of processor behavior are not completely specified; those features are either implementation-dependent or implementation-defined.
An implementation-dependent feature is one where the implementation has discretion in how it is performed. Implementations are not required to document or explain how implementation-dependent features are performed.
An implementation-defined feature is one where the implementation has discretion in how it is performed. Conformant implementations must document how implementation-defined features are performed.
The following features are implementation-defined:
schema port. See Section 2.1, “p:dfdl-parse”.infoset representations (for example, JSON) are
supported. See Section 2.1, “p:dfdl-parse”.parameters supported and their semantics are implementation-defined
.
See Section 2.1, “p:dfdl-parse”.schema port. See Section 2.2, “p:dfdl-unparse”.infoset representations (for example, JSON) are
supported. See Section 2.2, “p:dfdl-unparse”.parameters supported and their semantics are implementation-defined
. See Section 2.2, “p:dfdl-unparse”.This step has no implementation-dependent features.
[XProc 3.2] XProc 3.2: An XML Pipeline Language. Norman Walsh, Achim Berndzen, Gerrit Imsieke and Erik Siegel, editors.
[Data Format Description Language] Data Format Description Language (DFDL) 1.0 Specification. M. Beckerle and S. Hanson, editors. Open Grid Forum. February, 2021.
A dynamic error is one which occurs while a pipeline is being evaluated.
An implementation-defined feature is one where the implementation has discretion in how it is performed. Conformant implementations must document how implementation-defined features are performed.
An implementation-dependent feature is one where the implementation has discretion in how it is performed. Implementations are not required to document or explain how implementation-dependent features are performed.
This specification includes by reference a number of ancillary files.
An XProc step library for the declared steps.