Serialization and Parsing options


There are several global (shell scope) options that control serialization and parsing. These control default parameters used whenever plain text is parsed into XML , and when XML is serialized to text.

Most commands (where noted) can also accept these options which override the shell options for just that command.



Parsing Options


The following global parsing options may be set by the set command.

-text-encoding encodingThe default encoding any time that text is read or written and otherwise the encoding is not known. Defaults to the java file.encoding property. Sets both -input-text-encoding and -output-text-encoding
-input-text-encoding encodingThe default encoding any time that text is read and the encoding is not known. Defaults to the java file.encoding property.
-input-encoding encodingSets both text and xml input encoding
-encoding encodingsets both the text-encoding and xml-encoding option
-supports-dtdindicates if the parser should support DTD validation
-input-xml-encoding encodingDefault encoding used for parsing xml



Serializing Options


The following global serialization options may be set by the set command. These may be overwritten by specific commands.

-omit-xml-declarationOmit the leading xml declaration.
-indentIndent text serialized xml for more human friendly output
-xml-encoding encodingDefault encoding used for parsing and serializing xml
-output-xml-encoding encodingDefault encoding used for serialized xml
-output-encoding encodingSets both text and xml output encoding
-content-type typespecifies the content type
-method output-methodspecifies the output method, must be one of (text,html,xml,xhtml)
-sequence-sep stringspecifies the sequence separator string used when serializing sequences to text
default is LF
-sequence-term stringspecifies the sequence terminator string used when serializing sequences to text
default is LF


Options without arguments can be preceded by a + instead of a - to inverse the setting.


Examples


Indentation

Indentation is controlled with the -indent option. Default is indentation.

Example
xecho <[ <foo><bar/></foo> ]>

Results
<foo>
   <bar/>
</foo>

Example
xecho +indent <[ <foo><bar/></foo> ]>

Result
<foo><bar/></foo>

Example of setting +indent globally using the set command
set +indent
xecho <[ <foo><bar/></foo> ]>

Result
<foo><bar/></foo>




Serialization
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki