xmlrpc::construct (private)
xmlrpc::construct context arglist
Defined in packages/xml-rpc/tcl/xml-rpc-procs.tcl
Construct an XML-RPC element.
Example:arglist
is a 2-element list which is converted to XML. The first element ofarglist
is the datatype and the second element is the value.set arglist {-int 33} set result [xmlrpc::construct {} $arglist] set result ==> <i4>33</i4>This proc works recursively, so if your top level list has a list within it, then that list will be processed first. The two examples of this are arrays and structs. In addition, structs and arrays can contain each other.
Array example:set arglist {-array { {-int 6682} {-boolean 0} {-text Iowa} {-double 8931.33333333} {-date {Fri Jan 01 05:41:30 EST 1904}}}} set result [xmlrpc::construct {} $arglist] set result ==> <array> <data> <value> <i4>6682</i4> </value> <value> <boolean>0</boolean> </value> <value> <string>Iowa</string> </value> <value> <double>8931.33333333</double> </value> <value> <dateTime.iso8601>19040101T05:41:30</dateTime.iso8601> </value> </data> </array>Struct Example:
struct
's have the special format:-struct {name1 {-datatype1 value1} name2 {-datatype2 value2}}
set arglist {-struct { ctLeftAngleBrackets {-int 5} ctRightAngleBrackets {-int 6} ctAmpersands {-int 7} ctApostrophes {-int 0} ctQuotes {-int 3}}} set result [xmlrpc::construct {} $arglist] set result ==> <struct> <member> <name>ctLeftAngleBrackets</name> <value> <i4>5</i4> </value> </member> <member> <name>ctRightAngleBrackets</name> <value> <i4>6</i4> </value> </member> <member> <name>ctAmpersands</name> <value> <i4>7</i4> </value> </member> <member> <name>ctApostrophes</name> <value> <i4>0</i4> </value> </member> <member> <name>ctQuotes</name> <value> <i4>3</i4> </value> </member> </struct>The context parameter is used internally to create tags within tags.
Example:set arglist {-int 33} set result [xmlrpc::construct {foo bar} $arglist] set result ==> <foo><bar><i4>33</i4></bar></foo>
- Parameters:
- context (required)
- extra tags to wrap around the data
- arglist (required)
- datatype-value list (or more complex types as described above)
- Returns:
- XML formatted result
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- xml_rpc_construct