Revision [891]
This is an old revision of SerializationOptions made by DavidLee on 2009-11-24 16:06:08.
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 encoding - The default encoding any time that text is encountered and otherwise the encoding is not known. Defaults to the java file.encoding property.
- -encoding encoding - sets both the text-encoding and xml-encoding option
- -supports-dtd - indicates if the parser should support DTD validation
Serializing Options
The following global serialization options may be set by the set command. These may be overwritten by specific commands.
- -omit-xml-declaration - Omit the leading xml declaration.
- -indent - Indent text serialized xml for more human friendly output
- -xml-encoding - Default encoding used for serialized xml
- -content-type type - specifies the content type
- -method output-method - specifies the output method, must be one of (text,html,xml,xhtml)
Examples
Indentation
Indentation is controlled with the -indent option. Default is indentation.Example
xecho <[ <foo><bar/></foo> ]>
Results
<foo> <bar/> </foo>
Result
xecho +indent <[ <foo><bar/></foo> ]>
Result
<foo><bar/></foo>
Serialization