Wiki source for SerializationOptions


Show raw source

======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 [[CommandSet set]] command.

||-text-encoding encoding||The 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 encoding||The default encoding any time that text is read and the encoding is not known. Defaults to the java file.encoding property.||
||-input-encoding encoding||Sets both text and xml input encoding||
||-encoding encoding||sets both the text-encoding and xml-encoding option||
||-supports-dtd||indicates if the parser should support DTD validation||
||-input-xml-encoding encoding||Default encoding used for parsing xml||



=====Serializing Options=====

The following global serialization options may be set by the [[CommandSet 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 encoding||Default encoding used for parsing and serializing xml||
||-output-xml-encoding encoding||Default encoding used for serialized xml||
||-output-encoding encoding||Sets both text and xml output encoding||
||-content-type type||specifies the content type||
||-method output-method||specifies the output method, must be one of (text,html,xml,xhtml)||
||-sequence-sep string||specifies the sequence separator string used when serializing sequences to text
default is LF||
||-sequence-term string||specifies 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 [[CommandSet set]] command
%%
set +indent
xecho <[ <foo><bar/></foo> ]>
%%
Result
%%
<foo><bar/></foo>
%%


----
[[Serialization]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki