====Name====
**xquote** converts XML types into a string.
====Synopsis====
xquote [options] [expressions]
====Options====
Supports the standard [ [[SerializationOptions serialization options]] ]
||-n||Do not terminate or seperate expressions with a sequence terminator.||
||-p,-port port||Output to a named port instead of stdout||
====Description====
**xquote** quotes the expressions, or if none, quotes the standard input and outputs as text, optionally seperated and terminated by the sequence terminator (typically LF).
The result may not be obvious depending on where you are outputing the results. This is not the same as a literal quote, nor is it XML text encoding; rather it is a type conversion. The resultant type, if stored in an XML variable is of type xs:string.
You can use [[CommandXunquote xunquote]] to reverse the process.
Typical use of **xquote** is to construct XML messages with string content which contains XML encode XML bodies.
For example a SOAP message which contains a string representation of an XML document.
Example:
%%(shell)
xquote <[ bar ]>
%%
Result
%%(xml)
bar
%%
Example
%%
xquote -n <[ bar ]> >{var}
xecho <[ {$var} ]>
%%
Result
%%
<foo>bar</foo>
%%
Example:
%%
var=<[ bar ]>
xtype $var $<(xquote $var)
echo $<(xquote $var)
xecho $<(xquote $var)
%%
Result:
%%
element()
xs:string
bar
<foo>bar</foo>
%%
Note that xquote used in combination with [[CommandXecho xecho]] will XML Encode the result, wherase using [[CommandEcho echo]] will not.
====Return Value====
Returns 0 if the command is successful
----
[[Commands]]
[[CategoryCommands]]
[[CommandXunquote]]