XML functions allow serializing and deserializing between XML strings and qore data structures. There are also functions for XML-RPC support; see below for details and see the XmlRpcClient Class for a class supporting communication with this protocol.
Serializes a hash into an XML string with formatting without an XML header.
makeFormattedXMLFragment(hash $data, string $encoding) returns string
makeFormattedXMLFragment(hash $data) returns string
makeFormattedXMLFragment() returns nothing (RT_NOOP)
$xml = makeFormattedXMLFragment($hash);
Table 3.420. Arguments and Return Values for makeFormattedXMLFragment()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the Qore hash to an XML string (see XML Integration for more information) without an XML header but with formatting. The hash must have only one top-level key or an exception will be thrown. The optional second argument can give the output string encoding, otherwise UTF-8 is used (not the default encoding for the process). |
Table 3.421. Exceptions Thrown by makeFormattedXMLFragment()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC call format with whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCCallString(string $method, ...) returns string
$xml = makeFormattedXMLRPCCallString("method.name", $arg1, $arg2);
Table 3.422. Arguments and Return Values for makeFormattedXMLRPCCallString()
Argument Type | Return Type | Description |
|---|---|---|
| Serializes the arguments into an XML string in XML-RPC call format with whitespace formatting. The encoding of the resulting string will always be the default encoding. |
Table 3.423. Exceptions Thrown by makeFormattedXMLRPCCallString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string for an XML-RPC call with whitespace formatting, taking an initial string argument to give the encoding for the created XML.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCCallStringWithEncoding(string $encoding, string $method, ...) returns string
$xml = makeFormattedXMLRPCCallStringWithEncoding("ISO-8859-1", "method.name", $arg1, $arg2);
Table 3.425. Exceptions Thrown by makeFormattedXMLRPCCallStringWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC call format with whitespace formatting, taking a single argument following the XML-RPC method name for the argument list to the method.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCCallStringArgs(string $method, any $args) returns string
$xml = makeFormattedXMLRPCCallStringArgs("method.name", $arg_list);
Table 3.426. Arguments and Return Values for makeFormattedXMLCallStringArgs()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC call format with whitespace formatting, using a single argument following the XML-RPC method name as the argument list for the method. The encoding of the resulting string will always be the default encoding. |
Table 3.427. Exceptions Thrown by makeFormattedXMLRPCCallStringArgs()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC call with whitespace formatting, taking an initial string argument to give the encoding for the created XML, followed by the method name, followed by a single list argument for the argument list.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCCallStringArgsWithEncoding(string $encoding, string $method, any $args) returns string
$xml = makeFormattedXMLRPCCallStringArgsWithEncoding("ISO-8859-1", "method.name", $arg_list);
Table 3.428. Arguments and Return Values for makeFormattedXMLRPCCallStringArgsWithEncoding()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC call format with whitespace formatting, using a single argument following the XML-RPC method name as the argument list for the method. The encoding of the resulting string will be the encoding given by the first argument. |
Table 3.429. Exceptions Thrown by makeFormattedXMLRPCCallStringArgsWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCFaultResponseString(any $code, string $msg) returns string
$xml = makeFormattedXMLRPCFaultResponseString(10, "oh no, big error");
Table 3.430. Arguments and Return Values for makeFormattedXMLRPCFaultResponseString()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting. The first argument is converted to an integer to give the XML-RPC error code. The encoding of the resulting string will always be the default encoding. |
Table 3.431. Exceptions Thrown by makeFormattedXMLRPCCallStringArgs()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| missing either the error code or the error string arguments. |
Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting, taking an initial string argument to give the encoding for the created XML.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCFaultResponseStringWithEncoding(string $encoding, any $code, string $msg) returns string
$xml = makeFormattedXMLRPCFaultResponseStringWithEncoding("ISO-8859-2", 10, "oh no, big error");
Table 3.432. Arguments and Return Values for makeFormattedXMLRPCFaultResponseStringWithEncoding()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string formatted for an XML-RPC fault response with whitespace formatting. The first argument give the XML-RPC fault code. The encoding of the resulting string will be the encoding given by the first argument. |
Table 3.433. Exceptions Thrown by makeFormattedXMLRPCCallStringArgsWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| missing either the error code or the error string arguments. |
Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCResponseString(...) returns any
$xml = makeFormattedXMLRPCResponseString($value);
Table 3.434. Arguments and Return Values for makeFormattedXMLRPCResponseString()
Argument Type | Return Type | Description |
|---|---|---|
| Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting>. The encoding of the resulting string will always be the default encoding. |
Table 3.435. Exceptions Thrown by makeFormattedXMLRPCResponseString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC response with whitespace formatting, taking an initial string argument to give the encoding for the created XML.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCResponseStringWithEncoding(string $encoding, ...) returns any
$xml = makeFormattedXMLRPCResponseStringWithEncoding("ISO-8859-1", $value);
Table 3.437. Exceptions Thrown by makeFormattedXMLRPCResponseStringWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC value format with whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeFormattedXMLRPCValueString(any $data, string $encoding) returns string
makeFormattedXMLRPCValueString(any $data) returns string
$xml = makeFormattedXMLRPCValueString($value);
Table 3.438. Arguments and Return Values for makeFormattedXMLRPCValueString()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC value format with whitespace formatting. The optional second argument may be given to set the output string encoding, otherwise the encoding of the resulting string will be the default encoding. |
Table 3.439. Exceptions Thrown by makeFormattedXMLRPCValueString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes a hash into an XML string with formatting and an XML header.
makeFormattedXMLString(hash $data) returns string
makeFormattedXMLString(hash $data, string $encoding) returns string
makeFormattedXMLString(string $top_element, hash $data) returns string
makeFormattedXMLString(string, hash $data, string) returns string $encoding
$xml = makeFormattedXMLString($hash);
$xml = makeFormattedXMLString("key", $hash);
Table 3.440. Arguments and Return Values for makeFormattedXMLString()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the Qore hash to an XML string (see XML Integration for more information) with an XML header and formatting. The hash must have only one top-level key or an exception will be thrown. The optional second argument may be given to specify the output string encoding, otherwise UTF-8 will be used. | ||
Serializes the Qore hash to an XML string (see XML Integration for more information) with an XML header and formatting. The first parameter will be the top-level XML element. The optional third argument may be given to specify the output string encoding, otherwise UTF-8 will be used. |
Table 3.441. Exceptions Thrown by makeFormattedXMLString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| Incorrect arguments passed. |
Serializes a hash into an XML string without whitespace formatting and without an XML header.
makeXMLFragment(hash $data, string $encoding) returns string
makeXMLFragment(hash $data) returns string
makeXMLFragment() returns nothing (RT_NOOP)
$xml = makeXMLFragment($hash);
Table 3.442. Arguments and Return Values for makeXMLFragment()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the Qore hash to an XML string (see XML Integration for more information) without an XML header and without whitespace formatting. The hash must have only one top-level key or an exception will be thrown. The optional second argument can give the output string encoding, otherwise the default encoding is used. |
Table 3.443. Exceptions Thrown by makeXMLFragment()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCCallString(string $method, ...) returns string
$xml = makeXMLRPCCallString("method.name", $arg1, $arg2);
Table 3.444. Arguments and Return Values for makeXMLRPCCallString()
Argument Type | Return Type | Description |
|---|---|---|
| Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting. The encoding of the resulting string will always be the default encoding. |
Table 3.445. Exceptions Thrown by makeXMLRPCCallString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting, taking an initial string argument to give the target character encoding for the XML string.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCCallStringWithEncoding(string $encoding, string $method, ...) returns string
$xml = makeXMLRPCCallStringWithEncoding("ISO-8859-2", "method.name", $arg1, $arg2);
Table 3.447. Exceptions Thrown by makeXMLRPCCallStringWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting, taking a single argument following the XML-RPC method name for the argument list to the method.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCCallStringArgs(string $method, any $args) returns string
$xml = makeXMLRPCCallStringArgs("method.name", $arg_list);
Table 3.448. Arguments and Return Values for makeXMLCallStringArgs()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting, using a single argument following the XML-RPC method name as the argument list for the method. The encoding of the resulting string will always be the default encoding. |
Table 3.449. Exceptions Thrown by makeXMLRPCCallStringArgs()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC call without whitespace formatting, taking an initial string argument to give the target character encoding for the XML string followed by a list argument for the argument list.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCCallStringArgsWithEncoding(string $encoding, string $method, any $args) returns string
$xml = makeXMLRPCCallStringArgsWithEncoding("ISO-8859-2", "method.name", $arg_list);
Table 3.450. Arguments and Return Values for makeXMLCallStringArgsWithEncoding()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC call format without whitespace formatting, using a single argument following the XML-RPC method name as the argument list for the method. The encoding of the resulting string will correspond to the encoding given as the first argument to the function. |
Table 3.451. Exceptions Thrown by makeXMLRPCCallStringArgsWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC fault response without whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCFaultResponseString(any $code, string $msg) returns string
$xml = makeXMLRPCFaultResponseString(10, "oh no, an error occured");
Table 3.453. Exceptions Thrown by makeXMLRPCFaultResponseString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| missing either the error code or the error string arguments. |
Serializes the arguments into an XML string formatted for an XML-RPC fault response without whitespace formatting, taking an initial string argument to give the target character encoding for the XML string.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCFaultResponseStringWithEncoding(string $encoding, any $code, string $msg) returns string
$xml = makeXMLRPCFaultResponseStringWithEncoding("ISO-8859-2", 10, "oh no, an error occured");
Table 3.455. Exceptions Thrown by makeXMLRPCFaultResponseStringWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| missing either the error code or the error string arguments. |
Serializes the arguments into an XML string formatted for an XML-RPC response without whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCResponseString(...) returns any
$xml = makeXMLRPCResponseString($response);
Table 3.456. Arguments and Return Values for makeXMLRPCResponseString()
Argument Type | Return Type | Description |
|---|---|---|
| Serializes the arguments into an XML string formatted for an XML-RPC response without whitespace formatting>. The encoding of the resulting string will always be the default encoding. |
Table 3.457. Exceptions Thrown by makeXMLRPCResponseString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string formatted for an XML-RPC response without whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCResponseStringWithEncoding(string $encoding, ...) returns any
$xml = makeXMLRPCResponseStringWithEncoding("ISO-8859-2", $response);
Table 3.459. Exceptions Thrown by makeXMLRPCResponseStringWithEncoding()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes the arguments into an XML string in XML-RPC value format without whitespace formatting.
For information about XML-RPC serialization, see XML-RPC Serialization.
makeXMLRPCValueString(any, $data string $encoding) returns string
makeXMLRPCValueString(any $data) returns string
$xml = makeXMLRPCValueString($value);
Table 3.460. Arguments and Return Values for makeXMLRPCValueString()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the arguments into an XML string in XML-RPC value format without whitespace formatting. The encoding of the resulting string will always be the default encoding. |
Table 3.461. Exceptions Thrown by makeXMLRPCValueString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
Serializes a hash into an XML string without whitespace formatting but with an XML header.
makeXMLString(hash $data) returns string
makeXMLString(hash $data, string $encoding) returns string
makeXMLString(string $top_element, hash $data) returns string
makeXMLString(string, hash $data, string) returns string $encoding
$xml = makeXMLString($hash);
$xml = makeXMLString("key", $hash);
Table 3.462. Arguments and Return Values for makeXMLString()
Argument Type | Return Type | Description |
|---|---|---|
Serializes the Qore hash to an XML string (see XML Integration for more information) with an XML header but without whitespace formatting. The hash must have only one top-level key or an exception will be thrown. The optional second argument may be given to specify the output string encoding, otherwise UTF-8 will be used. | ||
Serializes the Qore hash to an XML string (see XML Integration for more information) with an XML header but without whitespace formatting. The first parameter will be the top-level XML element. The optional third argument may be given to specify the output string encoding, otherwise UTF-8 will be used. |
Table 3.463. Exceptions Thrown by makeXMLString()
err | desc |
|---|---|
| An error occurred serializing the Qore data to an XML string. |
| Incorrect arguments passed. |
Parses an XML string and returns a Qore hash structure. If duplicate, out-of-order XML elements are found in the input string, they are deserialized to Qore hash elements with the same name as the XML element but including a caret "^" and a numeric prefix to maintain the same key order in the Qore hash as in the input XML string.
This function should only be used when it is important to maintain the XML element order in the resulting Qore data structure (for example, when the data must be re-serialized to an XML string and the element order within a subelement must be maintained), for example, when parsing and reserializing an OSX property list in XML format. Otherwise parseXMLAsData() should be used instead.
parseXML(string $xml_string) returns hash
$hash = parseXML($xml);
Table 3.464. Arguments and Return Values for parseXML()
Argument Type | Return Type | Description |
|---|---|---|
Parses an XML string and returns a Qore hash structure. If no second argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.465. Exceptions Thrown by parseXML()
err | desc |
|---|---|
| Error parsing the XML string. |
Parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list) and returns a Qore hash structure.
Note that data deserialized with this function may not be reserialized to an identical XML string to the input due to the fact that duplicate, out-of-order XML elements are collapsed into lists in the resulting Qore hash, thereby losing the order in the original XML string.
For a similar function preserving the order of keys in the XML in the resulting Qore hash by generating Qore hash element names with numeric suffixes, see parseXML().
parseXMLAsData(string $xml_string) returns hash
parseXMLAsData(string $xml_string, string $encoding) returns hash
parseXMLAsData() returns nothing (RT_NOOP)
$hash = parseXMLAsData($xml);
Table 3.466. Arguments and Return Values for parseXMLAsData()
Argument Type | Return Type | Description |
|---|---|---|
Parses an XML string and returns a Qore hash structure. If no second argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.467. Exceptions Thrown by parseXMLAsData()
err | desc |
|---|---|
| Error parsing the XML string. |
Parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list), validates the XML string against a RelaxNG schema string, and returns a Qore hash structure. If any errors occur parsing the RelaxNG schema string, parsing the XML string, or validating the XML against the XSD, exceptions are thrown. If no encoding string argument is passed, then all strings in the resulting hash will be in UTF-8 encoding regardless of the input encoding of the XML string.
Please note that data deserialized with this function may not be reserialized to an identical XML string to the input due to the fact that duplicate, out-of-order XML elements are collapsed into lists in the resulting Qore hash, thereby losing the order in the original XML string.
For a similar function preserving the order of keys in the XML in the resulting Qore hash by generating Qore hash element names with numeric suffixes, see parseXMLWithRelaxNG(). See also parseXMLAsDataWithSchema() and parseXMLWithSchema().
The availability of this function depends on the presence of libxml2's xmlTextReaderRelaxNGSetSchema() function when Qore was compiled; for maximum portability check the constant HAVE_PARSEXMLWITHRELAXNG before running this function. See Library Option Constants for a list of all option constants.
parseXMLAsDataWithRelaxNG(string $xml_string, string $relaxng_string) returns hash
parseXMLAsDataWithRelaxNG(string $xml_string, string $relaxng_string, string $encoding) returns hash
$hash = parseXMLAsDataWithRelaxNG($xml, $rng);
Table 3.468. Arguments and Return Values for parseXMLAsDataWithRelaxNG()
Argument Type | Return Type | Description |
|---|---|---|
| Parses an XML string (1st argument), validates against the RelaxNG string (2nd argument), and returns a Qore hash structure. If no third argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.469. Exceptions Thrown by parseXMLAsDataWithRelaxNG()
err | desc |
|---|---|
| Error parsing the XML string. |
| Invalid arguments passed to the function. |
| This exception is thrown when the function is not available; for maximum portability, check the constant |
Parses an XML string as data (does not preserve hash order with out-of-order duplicate keys: collapses all to the same list), validates the XML string against an XSD schema string, and returns a Qore hash structure. If any errors occur parsing the XSD string, parsing the XML string, or validating the XML against the XSD, exceptions are thrown. If no encoding string argument is passed, then all strings in the resulting hash will be in UTF-8 encoding regardless of the input encoding of the XML string.
Please note that data deserialized with this function may not be reserialized to an identical XML string to the input due to the fact that duplicate, out-of-order XML elements are collapsed into lists in the resulting Qore hash, thereby losing the order in the original XML string.
For a similar function preserving the order of keys in the XML in the resulting Qore hash by generating Qore hash element names with numeric suffixes, see parseXMLWithSchema(). See also parseXMLAsDataWithRelaxNG() and parseXMLWithRelaxNG().
The availability of this function depends on the presence of libxml2's xmlTextReaderSetSchema() function when Qore was compiled; for maximum portability check the constant HAVE_PARSEXMLWITHSCHEMA before running this function. See Library Option Constants for a list of all option constants.
parseXMLAsDataWithSchema(string $xml_string, string $xsd) returns hash
parseXMLAsDataWithSchema(string $xml_string, string $xsd, string $encoding) returns hash
$hash = parseXMLAsDataWithSchema($xml, $xsd);
Table 3.470. Arguments and Return Values for parseXMLAsDataWithSchema()
Argument Type | Return Type | Description |
|---|---|---|
Parses an XML string (1st argument), validates against the XSD string (2nd argument), and returns a Qore hash structure. If no third argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.471. Exceptions Thrown by parseXMLAsDataWithSchema()
err | desc |
|---|---|
| Error parsing the XML string. |
| Invalid arguments passed to the function. |
| This exception is thrown when the function is not available; for maximum portability, check the constant |
Deserializies an XML-RPC call string, returning a Qore data structure representing the call information.
parseXMLRPCCall(string $xml_string) returns hash
parseXMLRPCCall(string $xml_string, string $encoding) returns hash
parseXMLRPCCall() returns nothing (RT_NOOP)
$hash = parseXMLRPCCall($xml);
Table 3.472. Arguments and Return Values for parseXMLRPCCall()
Argument Type | Return Type | Description |
|---|---|---|
Deserializies an XML-RPC call string, returning a Qore data structure representing the call information. The hash will have the following keys: |
Table 3.473. Exceptions Thrown by parseXMLRPCCall()
err | desc |
|---|---|
| Error parsing the XML-RPC call string. |
| Error parsing an XML-RPC value node. |
Deserializies an XML-RPC response string, returning a Qore data structure representing the response information.
parseXMLRPCResponse(string $xml_string) returns hash
parseXMLRPCResponse(string $xml_string, string $encoding) returns hash
parseXMLRPCResponse() returns nothing (RT_NOOP)
$hash = parseXMLRPCResponse($xml);
Table 3.474. Arguments and Return Values for parseXMLRPCResponse()
Argument Type | Return Type | Description |
|---|---|---|
Deserializies an XML-RPC response string, returning a Qore data structure representing the response information. The hash will have either a "fault" or a "params" key, depending on if it's a fault response or a non-fault response. If no second argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.475. Exceptions Thrown by parseXMLRPCResponse()
err | desc |
|---|---|
| Error parsing the XML-RPC response string. |
| Error parsing an XML-RPC value node. |
Deserializies an XML-RPC value tree, returning a Qore data structure representing the information.
parseXMLRPCValue(string $xml_string) returns hash
parseXMLRPCValue(string $xml_string, string $encoding) returns hash
parseXMLRPCValue() returns nothing (RT_NOOP)
my any $data = parseXMLRPCValue($xml);
Table 3.476. Arguments and Return Values for parseXMLRPCValue()
Argument Type | Return Type | Description |
|---|---|---|
Deserializies an XML-RPC value string, returning Qore data representing the value data. If no second argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.477. Exceptions Thrown by parseXMLRPCValue()
err | desc |
|---|---|
| Error parsing an XML-RPC value node. |
Parses an XML string, validates the XML string against a RelaxNG schema string, and returns a Qore hash structure. If any errors occur parsing the RelaxNG string, parsing the XML string, or validating the XML against the RelaxNG schema, exceptions are thrown. If no encoding string argument is passed, then all strings in the resulting hash will be in UTF-8 encoding regardless of the input encoding of the XML string.
If duplicate, out-of-order XML elements are found in the input string, they are deserialized to Qore hash elements with the same name as the XML element but including a caret "^" and a numeric prefix to maintain the same key order in the Qore hash as in the input XML string.
This function should only be used when it is important to maintain the XML element order in the resulting Qore data structure (for example, when the data must be re-serialized to an XML string and the element order within a subelement must be maintained), for example, when parsing and reserializing an OSX property list in XML format. Otherwise parseXMLAsDataWithRelaxNG() should be used instead.
See also parseXMLWithSchema() and parseXMLAsDataWithSchema().
The availability of this function depends on the presence of libxml2's xmlTextReaderRelaxNGSetSchema() function when Qore was compiled; for maximum portability check the constant HAVE_PARSEXMLWITHRELAXNG before running this function. See Library Option Constants for a list of all option constants.
parseXMLWithRelaxNG(string $xml_string, string $relaxng_string) returns hash
parseXMLWithRelaxNG(string $xml_string, string $relaxng_string, string $encoding) returns hash
$hash = parseXMLWithRelaxNG($xml, $rng);
Table 3.478. Arguments and Return Values for parseXMLWithRelaxNG()
Argument Type | Return Type | Description |
|---|---|---|
| Parses an XML string (1st argument), validates against the RelaxNG schema string (2nd argument), and returns a Qore hash structure. If no third argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.479. Exceptions Thrown by parseXMLWithRelaxNG()
err | desc |
|---|---|
| Error parsing the XML string. |
| Invalid arguments passed to the function. |
| This exception is thrown when the function is not available; for maximum portability, check the constant |
Parses an XML string, validates the XML string against an XSD schema string, and returns a Qore hash structure. If any errors occur parsing the XSD string, parsing the XML string, or validating the XML against the XSD, exceptions are thrown. If no encoding string argument is passed, then all strings in the resulting hash will be in UTF-8 encoding regardless of the input encoding of the XML string.
If duplicate, out-of-order XML elements are found in the input string, they are deserialized to Qore hash elements with the same name as the XML element but including a caret "^" and a numeric prefix to maintain the same key order in the Qore hash as in the input XML string.
This function should only be used when it is important to maintain the XML element order in the resulting Qore data structure (for example, when the data must be re-serialized to an XML string and the element order within a subelement must be maintained), for example, when parsing and reserializing an OSX property list in XML format. Otherwise parseXMLAsDataWithSchema() should be used instead.
See also parseXMLWithRelaxNG() and parseXMLAsDataWithRelaxNG().
The availability of this function depends on the presence of libxml2's xmlTextReaderSetSchema() function when Qore was compiled; for maximum portability check the constant HAVE_PARSEXMLWITHSCHEMA before running this function. See Library Option Constants for a list of all option constants.
parseXMLWithSchema(string $xml_string, string $xsd) returns hash
parseXMLWithSchema(string $xml_string, string $xsd, string $encoding) returns hash
$hash = parseXMLWithSchema($xml, $xsd);
Table 3.480. Arguments and Return Values for parseXMLWithSchema()
Argument Type | Return Type | Description |
|---|---|---|
Parses an XML string (1st argument), validates against the XSD string (2nd argument), and returns a Qore hash structure. If no third argument is given, specifying the output string encoding, all strings will have the default encoding. |
Table 3.481. Exceptions Thrown by parseXMLWithSchema()
err | desc |
|---|---|
| Error parsing the XML string. |
| Invalid arguments passed to the function. |
| This exception is thrown when the function is not available; for maximum portability, check the constant |