XML formatting

Xoom Processor offers XML formatting directives that are used when XML documents are saved.

Railroad diagram for grammar entity XmlFormat in Xoom Processor.

XmlFormat
         ::= '[:' XmlOptionList ':]'

Railroad diagram for grammar entity XmlOptionList in Xoom Processor.

XmlOptionList
         ::= XmlOption ( ',' XmlOptionList )*

Railroad diagram for grammar entity XmlOption in Xoom Processor.

XmlOption
         ::= C14N
           | Indent
           | OmitDecl
           | 'default'

XML formatting directives affect the XML output from the point of definition onwards but can be nested in subsequences. Such directives hold for the duration of a subsequence but are discarded at the end, at which point any directives that held prior to the subsequence are reinstated.

C14N (canonicalisation, canonical XML)

Railroad diagram for grammar entity C14N in Xoom Processor.

C14N     ::= ( '+' | '-' )? 'c14n' 'rf'?

To enable pure canonical XML representation, use a [:c14n:] directive, or its verbose alternative [:+c14n:] (the initial + is implied).

To enable canonical XML representation where white space is reformatted according to the prevailing writer settings, for example to observe the indent XML formatting directive, use [:c14nrf:].

To disable the canonicalisation, use [:-c14n:]. This is the default.

Indent

Railroad diagram for grammar entity Indent in Xoom Processor.

Indent   ::= 'indent=' [0-9]+ ( 's' | 't' )

This directive allows you to specify the indentation that will be applied to each level in XML hierarchy. It allows you to use either space (s) or tab (t) characters. For example, [:indent=2s:] will specify two spaces (which is the default), and [:indent=1t:] will specify a single tab character.

OmitDecl (omit XML declaration)

Railroad diagram for grammar entity OmitDecl in Xoom Processor.

OmitDecl ::= '-'? ( 'OmitXmlDeclaration' | 'omitdecl' )

Use the [:OmitXmlDeclaration:] (long form) or [:omitdecl:] (short form) directive to produce XML output without an XML declaration at the top. To reinstate the declaration, use [:-OmitXmlDeclaration:].

MaxItemsInDir

Railroad diagram for grammar entity MaxItemsInDir in Xoom Processor.

MaxItemsInDir ::= 'MaxItemsInDir=' [0-9]+

This option is intended for use when saving configuration to Xoom folders. The option takes an integer n, which defaults to 0, meaning 'unlimited'. When this option is specified, Xoom directories with greater than n items will be split into 8 directories, or, if the number of items exceeds 8n, 64 directories. The names of these directories will be appended by one or two digits in base-8 (octal) accordingly. A hash code is generated for each item, and items will be placed into the folder that matches the last one or two octal digits of the hash. This ensures that when configuration versioning, the same item will always be placed in the same folder. Use this option to improve performance in virtualisation scenarios where there are folders with large numbers of files.

default

This directive reinstates default Xoom Processor XML formatting.

XML output formatting

xp source.xml [:indent=1t,c14nrt:] source_c14n.xml
Saves the contents of source.xml as canonical XML indented using a single tab character in file source_c14n.xml.