Name
xquote converts XML types into a string.Synopsis
xquote [options] [expressions]Options
Supports the standard [ 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 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:
xquote <[ <foo>bar</foo> ]>
Result
<foo>bar</foo>
Example
xquote -n <[ <foo>bar</foo> ]> >{var} xecho <[ <elem>{$var}</elem> ]>
Result
<elem><foo>bar</foo></elem>
Example:
var=<[ <foo>bar</foo> ]> xtype $var $<(xquote $var) echo $<(xquote $var) xecho $<(xquote $var)
Result:
element() xs:string <foo>bar</foo> <foo>bar</foo>
Note that xquote used in combination with xecho will XML Encode the result, wherase using echo will not.
Return Value
Returns 0 if the command is successfulCommands
CategoryCommands
CommandXunquote