The oxf:
, file:
and http:
protocols allow writing.
When using the oxf:
protocol, the Filesystem and WebApp resource managers support write operations.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Orbeon Forms User Guide
|
Other Serializers
1. ScopeSerializers are processors with no XML output. A serializer, just like any processor, can access files, connect to databases, and take actions depending on its inputs. See also the HTTP serializer. 2. URL Serializer
The URL serializer mirrors the functionality of the URL
generator. Instead of reading from of URL, it writes its Note
The
When using the
The URL serializer takes a <p:processor name="oxf:url-serializer"><p:input name="config"><config><url>oxf:/path/current.xml</url></config></p:input><p:input name="data" href="#xml-data"/></p:processor>
3. File SerializerThe File serializer supports decoding binary or text data encapsulated in XML documents and writing it to a file on disk. The configuration consists of the following elements:
Here is how you serialize a document produced by a pipeline to a file on disk: <!-- Convert a document to serialized XML --><p:processor name="oxf:xml-converter"><p:input name="config"><config><encoding>utf-8</encoding></config></p:input><p:input name="data" href="#my-document"/><p:output name="data" id="converted"/></p:processor><!-- Write the document to a file --><p:processor name="oxf:file-serializer"><p:input name="config"><config><directory>build/doc/reference</directory><file>single-file-doc.html</file><make-directories>true</make-directories><append>false</append></config></p:input><p:input name="data" href="#converted"/></p:processor>
Note the use of the XML converter processor, which serializes the XML document produced by the pipeline to a textual representation of XML. Here is how you can copy a file specified with a URL from one location to the other, by using the URL generator and the File serializer: <!-- Read original file --><p:processor name="oxf:url-generator"><p:input name="config"><config><url>file:/my-image.jpg</url></config></p:input><p:output name="data" id="image-data"/></p:processor><!-- Write to another file --><p:processor name="oxf:file-serializer"><p:input name="config"><config><file>/my-copied-image.jpg</file></config></p:input><p:input name="data" href="#image-data"/></p:processor>
The File serializer is most useful in a command-line application, but can be used in web applications as well. 4. Scope SerializerThe Scope serializer can store documents into the application, session and request scopes. It works together with the Scope generator.
The Scope serializer has a <config><key>cart</key><scope>application|session|request</scope><session-scope>application|portlet</session-scope></config>
In addition to the Note
The Session serializer, previously used, is now deprecated. Use the Scope serializer with session scope instead. 5. Null Serializer
The Null serializer acts as a black hole. The <p:processor name="oxf:null-serializer"><p:input name="data" href="#document"/></p:processor>
6. Flushing the Output Stream
All serializers (XML, HTML, text, and FOP) will flush their output stream when they
encounter the following processing instruction: 7. Legacy HTTP SerializersNote
Use of these serializers should be replaced by converters connected to the HTTP serializer. These serializers share a common functionality: writing their data input to an HTTP response. Typically, this means sending data back to a client web browser. This can be done in a Servlet environment or a Portlet environment. All share the same configuration, but differ in how they convert their input data. The following describes the common configuration, then the specifics for each serializer. Note
When using the command-line mode, instead of sending the output through HTTP, the HTTP serializers send their output to the standard output. In such a case, the parameters that do not affect the content of the data, such as content-type, status-code, etc. are ignored.
All serializers send the cache control HTTP headers, including
7.1. ConfigurationThe configuration consists of the following optional elements.
<config><content-type>text/html</content-type><status-code>100</status-code><empty-content>false</empty-content><error-code>0</error-code><version>4.01</version><public-doctype>-//W3C//DTD HTML 4.01//EN</public-doctype><system-doctype>http://www.w3.org/TR/html4/strict.dtd</system-doctype><omit-xml-declaration>false</omit-xml-declaration><standalone>true</standalone><encoding>utf-8</encoding><indent-amount>4</indent-amount><cache-control><use-local-cache>true</use-local-cache></cache-control><header><name>Content-Disposition</name><value>attachment; filename=image.jpeg;</value></header></config>
7.2. XML Serializer
This serializer writes XML text. The output is indented with no spaces and
encoded using the UTF-8 character set. The default content type is
<p:processor name="oxf:xml-serializer"><p:input name="config"><config><content-type>text/vnd.wap.wml</content-type></config></p:input><p:input name="data" href="#wml"/></p:processor>
7.3. HTML Serializer
The HTML serializer's output conforms to the XSLT <p:processor name="oxf:html-serializer"><p:input name="config"><config/></p:input><p:input name="data" href="#html"/></p:processor>
Note
The XML 1.0 Specification prohibits a DOCTYPE definition with a Public ID and no System ID. 7.4. Text Serializer
The Text serializer's output conforms to the XSLT <p:processor name="oxf:text-serializer"><p:input name="config"><config/></p:input><p:input name="data" href="#text"/></p:processor>
|