Serialize Command Line Reference

Serialize.exe is the XmlPrime command line XML serializer. It applies serialization options to an XML input.

The command-line options are case sensitive.

 
Serialize.exe [Options] [Input] [Parameters]
 

Arguments

ArgumentDescription

Input

The path to the input XML file. A single "-" character indicates that the query should be read from the standard input stream.

Options

OptionAliasDescription

-adaptive

Serialize using the Adaptive OUtput Method.

-canonical

Serialize as Canonical XML 1.0.

--dtd

-d

Enables the use of DTDs to validate input documents. By default, documents are not validated against their DTDs. Note that the DTDs are retrieved even when this option is disabled, as they are used to resolve entity references.

--emacs

Output errors and warnings in a single line format.

--help

-?

Displays usage instructions for the command line tool.

-html

Serialize as HTML. Equivalent to specifying !method==html.

-indent

Enables indentation. Equivalent to specifying !indent==yes.

-json

Serialize using the JSON OUtput Method.

-o filename

Specifies a file to which the serialized output should be written. If the file already exists it is overwritten, otherwise a new file is created. If this option is omitted then the output of the query is sent to the standard output.

-pd filename

Specifies an XML file from which serialization parameters should be read.

--preserve

Preserves all white space text nodes in all input documents. This cannot be used in conjunction with the

--strip
option.

--schema

-v

Validates input documents with XML Schema against the available schemas. All documents passed in on the command line or read by the transformation are validated against the available schemas. The available schemas used for validation contain:

  • Schemas imported using the --xsd option.
  • Schemas imported in the query.
  • Unless the --noxsiloc option is set, any schemas referenced in xs:schemaLocation or xs:noNamespaceSchemaLocation attributes are used to validate the document.

Note that this does not affect validate expressions, which will only validate against schemas imported in the query.

--strip

Strips insignificant whitespace text nodes from all input documents. This cannot be used in conjunction with the --preserve option.

-text

Serialize as text. Equivalent to specifying !method==text.

--time

-t

Displays the time taken to serialize the output.

-xhtml

Serialize as XHTML. Equivalent to specifying !method==xhtml.

-xml

Serialize as XML. Equivalent to specifying !method==xml.

---xsd schema

-x schema

Specifies the filename of an XML Schema to be added to the set of schemas available for validation. This mechanism also specifies the location of schemas imported in the query with no location hints. If the query imports a schema with the same namespace, then the schema supplied on the command line is used, regardless of which location hints are used.

--noxsiloc

Prevents schemas referenced by xsi:schemaLocation or xsi:noNamespaceSchemaLocation in imported documents from being loaded and added to the set of schemas used for validation.

Parameters

ParameterDescription

parametername=expression

Sets a query parameter to the specified value.

A query parameter is the definition of a global variable declared as external in the query or an imported module.

The parametername is the local name of the parameter to be set. The parameter is assumed to have no namespace. An external variable declared with a namespace can be referred to with the syntax {namespace}localname. If no external variable is found with the specified name, then this parameter is ignored.

expression is an XQuery expression that matches the ExprSingle production in the XQuery grammar. This is the same as the syntax that is valid for the definition of a global variable in an XQuery program.

+parametername=document

Sets a query parameter to the specified document.

A query parameter is the definition of a global variable declared as external in the query or an imported module.

The parametername is the local name of the parameter to be set. The parameter is assumed to have no namespace. An external variable declared with a namespace can be referred to with the syntax {namespace}localname. If no external variable is found with the specified name, then this parameter is ignored.

document is a path or URI to an XML document.

!parameter=value=value

Sets a serialization parameter.

Serialization parameters define how the result of the query is serialized. This is equivalent to adding the following declarations to the query:

 
              
declare namespace serialization="http://www.xmlprime.com/serialization";
declare option serialization:parameter "value";
            
 

If the requested serialization parameter does not exist this parameter is ignored. If a parameter is also set in the query, then the value passed on the command line takes precedence.

For a detailed description of all the available serialization parameters, see Serialization parameters.