Changes

Jump to navigation Jump to search
368 bytes removed ,  23:43, 26 May 2012
no edit summary
* by including them in the [[XQuery_3.0#Serialization|prolog of the XQuery expression]],
* by specifying them in the XQuery functions [[File_Module#file:write|file:write()]] or [[XQuery_3.0#Functions|fn:serialize()]],
* by using the <code>{{Code|-s</code> }} flag of the BaseX [[Startup_Options#BaseX|command-line]] clients,
* by setting the [[Options#SERIALIZER|SERIALIZER]] option before running a query,
* by setting the [[Options#EXPORTER|EXPORTER]] option before exporting a database, or
! Examples
|- valign="top"
| <code>{{Code|method</code>}}
| Specifies the serialization method:
* <code>{{Code|xml</code>}}, <code>{{Code|xhtml</code>}}, <code>{{Code|html</code>}}, and <code>{{Code|text</code> }} are adopted from the official specification.* <code>{{Code|html5</code> }} is specific to BaseX and can be used to output query results as [http://en.wikipedia.org/wiki/Html5 HTML5].* <code>{{Code|json</code> }} and <code>{{Code|jsonml</code> }} are specific to BaseX and can be used to output XML nodes in the JSON format (see the [[JSON Module]] for more details).* <code>{{Code|raw</code> }} is BaseX-specific as well: Binary data types are output in their ''raw'' form, i.e., without modifications. For all other types, the items’ string values are returned. No indentation takes place, and and no characters are encoded via entities.| <code>{{Code|xml</code>}}, <code>{{Code|xhtml</code>}}, <code>{{Code|html</code>}}, <code>{{Code|text</code>}}, <code>{{Code|html5</code>}}, <code>{{Code|json</code>}}, <code>{{Code|jsonml</code>}}, <code>{{Code|raw</code>}}| <code>{{Code|xml</code>}}
| <code>method=xml</code>
|- valign="top"
| <code>{{Code|version</code>}}
| Specifies the version of the serializer.
| <code>{{Code|xml/xhtml</code>}}: <code>{{Code|1.0</code>}}, <code>{{Code|1.1</code>}}<br/><code>{{Code|html</code>}}: <code>{{Code|4.0</code>}}, <code>{{Code|4.01</code>}}<br/>| <code>{{Code|1.0</code>}}
| <code>version=1.0</code>
|- valign="top"
| <code>{{Code|encoding</code>}}
| Encoding to be used for outputting the data.
| ''all encodings supported by Java''
| <code>{{Code|UTF-8</code>}}
| <code>encoding=US-ASCII</code>
|- valign="top"
| <code>{{Code|indent</code>}}
| Adjusts whitespaces to make the output better readable.
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|yes</code>}}
| <code>indent=no</code>
|- valign="top"
| <code>{{Code|cdata-section-elements</code>}}| List of elements to be output as CDATA, separated by whitespaces.<br />Example: <code>{{Code|&lt;text&gt;&lt;![CDATA[ &lt;&gt; ]]&gt;&lt;/text&gt;</code>}}
|
|
| <code>cdata-section-elements=text</code>
|- valign="top"
| <code>{{Code|omit-xml-declaration</code>}}
| Omits the XML declaration, which is serialized before the actual query result<br />Example: <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code>
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|yes</code>}}
| <code>omit-xml-declaration=no</code>
|- valign="top"
| <code>{{Code|standalone</code>}}
| Prints or omits the "standalone" attribute in the XML declaration.
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}, <code>{{Code|omit</code>}}| <code>{{Code|omit</code>}}
| <code>standalone=yes</code>
|- valign="top"
| <code>{{Code|doctype-system</code>}}| Introduces the output with a document type declaration and the given system identifier.<br />Example: <code>{{Code|&lt;!DOCTYPE x SYSTEM "entities.dtd"&gt;</code>}}
|
|
| <code>doctype-system=entities.dtd</code>
|- valign="top"
| <code>{{Code|doctype-public</code>}}| If <code>{{Code|doctype-system</code> }} is specified, adds a public identifier.<br />Example: <code>{{Code|&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "<nowiki>http://www.w3.org/TR/html4/strict.dtd</nowiki>"&gt;</code>}}
|
|
| <code>doctype-public=-//W3C//DTD HTML 4.01//EN,<br />doctype-system=http://www.w3.org/TR/html4/strict.dtd</code>
|- valign="top"
| <code>{{Code|undeclare-prefixes</code>}}
| Undeclares prefixes in XML 1.1.
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|no</code>}}
| <code>undeclare-prefixes=yes</code>
|- valign="top"
| <code>{{Code|normalization-form</code>}}| Specifies a normalization form. BaseX supports Form C (<code>{{Code|NFC</code>}}).| <code>{{Code|NFC</code>}}, <code>{{Code|none</code>}}| <code>{{Code|NFC</code>}}
| <code>normalization-form=none</code>
|- valign="top"
| <code>{{Code|media-type</code>}}
| Specifies the media type.
|
| <code>{{Code|application/xml</code>}}
| <code>media-type=text/plain</code>
|- valign="top"
| <code>{{Code|use-character-maps</code>}}
| Defines character mappings (not supported).
|
|
|- valign="top"
| <code>{{Code|byte-order-mark</code>}}
| Prints a byte-order-mark before starting serialization.
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|no</code>}}
| <code>byte-order-mark=yes</code>
|- valign="top"
| <code>{{Code|escape-uri-attributes</code>}}
| Escapes URI information in certain HTML attributes<br />Example: <code>&lt;a&nbsp;href="%C3%A4%C3%B6%C3%BC"&gt;äöü&lt;a&gt;</code>
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|no</code>}}
| <code>escape-uri-attributes=yes, method=html</code>
|- valign="top"
| <code>{{Code|include-content-type</code>}}| Includes a <code>{{Code|meta</code> }} content-type element if the result is output as HTML<br />Example: <code>&lt;head&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;&lt;/head&gt;</code>| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|no</code>}}
| <code>include-content-type=yes, method=html</code>
|}
! Examples
|- valign="top"
| <code>{{Code|format</code>}}
| Turns output formatting on/off, including the conversion of special characters to entities and insertion of item separators. This flag can be turned off to simplify the handling of plain-text results.
| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|yes</code>}}
| <code>format=no</code>
|- valign="top"
| <code>{{Code|tabulator</code>}}| Uses tab characters (<code>{{Code|\t</code>}}) for indenting elements.| <code>{{Code|yes</code>}}, <code>{{Code|no</code>}}| <code>{{Code|no</code>}}
| <code>tabulator=yes</code>
|- valign="top"
| <code>{{Code|indents</code>}}
| Specifies the number of characters to be indented.
| ''positive number''
| <code>{{Code|2</code>}}
| <code>indents=1, tabulator=yes</code>
|- valign="top"
| <code>{{Code|wrap-prefix</code>}},<br /><code>{{Code|wrap-uri</code>}}
| Specifies a prefix and/or URI for wrapping the query results.
|
| <code>wrap-prefix=rest, wrap-uri=http://basex.org/rest</code>
|- valign="top"
| <code>{{Code|newline</code>}}
| Specifies the type of newline to be used as end-of-line marker.
| <code>{{Code|\n</code>}}, <code>{{Code|\r\n</code>}}, <code>{{Code|\r</code>}}
| ''system dependent''
| <code>newline=\r\n</code>
|- valign="top"
| <code>{{Code|separator</code>}}
| Determines the string to be used as item separator. {{Mark|Introduced with Version 7.2}}
| ''arbitrary strings''
Bureaucrats, editor, reviewer, Administrators
13,554

edits

Navigation menu