WebSend (XmlDoc subroutine): Difference between revisions
m (1 revision) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:XmlDoc:WebSend subtitle}} | {{Template:XmlDoc:WebSend subtitle}} | ||
<var>WebSend</var> converts an <var>XmlDoc</var> to its textually represented XML document to be sent in a response on a <var class="product">[[Janus Web Server| | <var>WebSend</var> converts an <var>XmlDoc</var> to its textually represented XML document to be sent in a response on a <var class="product">[[Janus Web Server|Janus Web Server]]</var> thread. The process of converting to a text string is called '''serialization''', because the text representation of a document is called the '''serial''' | ||
form | form. | ||
The serialized output of <var>WebSend</var> is a UTF-8 text string. | The serialized output of <var>WebSend</var> is a UTF-8 text string. This output is added to the output buffer that is sent by a subsequent invocation of <var>[[$Web_Done]]</var> or <var>[[$Web_Form_Done]]</var>. | ||
==Syntax== | ==Syntax== | ||
Line 33: | Line 33: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The method object <var class="term"> | <li>The method object <var class="term">doc</var> must be [[XML processing in Janus SOAP#Well-formed documents and validation|well-formed]] (that is, it must contain an <var>Element</var> node). | ||
<li>The output line-breaking <var class="term">options</var> make the serialized stream easier to read, for example, for a browser's "view page source" facility to display XHTML produced with <var class="product">[[Janus SOAP | <li>The output line-breaking <var class="term">options</var> make the serialized stream easier to read, for example, for a browser's "view page source" facility to display XHTML produced with <var class="product">[[Janus SOAP]]</var>. | ||
<li>As of <var class="product"> | <li>As of <var class="product">Sirius Mods</var> Version 7.6, ''Attribute values'' are always serialized within double-quotation-mark (<tt>"</tt>) delimiters, and a double-quotation mark character in an attribute value is serialized as <code>&quot;</code>. Prior to <var class="product">Sirius Mods</var> Version 7.6, this convention was not strictly observed. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
The following <var class="product">Janus Web Server</var> program uses <var>[[WebReceive_(XmlDoc_function)|WebReceive]]</var> to obtain the XML document from the HTTP request, then uses <var>WebSend</var> to buffer some of the received data: | |||
<p class="code">begin | <p class="code">begin | ||
%d object xmlDoc | %d object xmlDoc | ||
%d = new | %d = new | ||
%d: | %d:webReceive | ||
%d2 object xmlDoc | %d2 object xmlDoc | ||
%d2 = new | %d2 = new | ||
Line 51: | Line 51: | ||
%d2:webSend | %d2:webSend | ||
end | end | ||
</p | </p> | ||
==Request-cancellation errors== | ==Request-cancellation errors== | ||
<ul> | <ul> | ||
<li><var class="term"> | <li>Method object <var class="term">doc</var> does not contain an <var>Element</var>. | ||
<li>An <var class="term">options</var> setting is invalid. | <li>An <var class="term">options</var> setting is invalid. | ||
<li>Insufficient free space exists in CCATEMP. | <li>Insufficient free space exists in CCATEMP. |
Revision as of 01:33, 25 May 2011
Serialize XmlDoc as Web response (XmlDoc class)
WebSend converts an XmlDoc to its textually represented XML document to be sent in a response on a Janus Web Server thread. The process of converting to a text string is called serialization, because the text representation of a document is called the serial form.
The serialized output of WebSend is a UTF-8 text string. This output is added to the output buffer that is sent by a subsequent invocation of $Web_Done or $Web_Form_Done.
Syntax
doc:WebSend[( [options])]
Syntax terms
doc | An expression that points to the XmlDoc whose content is to be serialized. |
---|---|
options | A blank delimited string that can contain one or more (but no duplications) of the following options:
|
Usage notes
- The method object doc must be well-formed (that is, it must contain an Element node).
- The output line-breaking options make the serialized stream easier to read, for example, for a browser's "view page source" facility to display XHTML produced with Janus SOAP.
- As of Sirius Mods Version 7.6, Attribute values are always serialized within double-quotation-mark (") delimiters, and a double-quotation mark character in an attribute value is serialized as
"
. Prior to Sirius Mods Version 7.6, this convention was not strictly observed.
Examples
The following Janus Web Server program uses WebReceive to obtain the XML document from the HTTP request, then uses WebSend to buffer some of the received data:
begin %d object xmlDoc %d = new %d:webReceive %d2 object xmlDoc %d2 = new %d2:loadXml('<sum>' with - %d:value('/*/*[1]') + %d:value('/*/*[2]') - with '</sum>') %d2:webSend end
Request-cancellation errors
- Method object doc does not contain an Element.
- An options setting is invalid.
- Insufficient free space exists in CCATEMP.
See also
- Use the Serial function to serialize an XmlDoc for sending in some other fashion than as a Web response.
- Additional serializing methods include:
- AddXml (HttpRequest class)
- The function that receives and deserializes a Web XML request is WebReceive.