format_xml_elements

function format_xml_elements

format_xml_elements($array)

Formats XML elements.

Parameters

$array: An array where each item represents an element and is either a:

  • (key => value) pair (<key>value</key>)
  • Associative array with fields:
    • 'key': element name
    • 'value': element contents
    • 'attributes': associative array of element attributes
    • 'encoded': TRUE if 'value' is already encoded

In both cases, 'value' can be a simple string, or it can be another array with the same format as $array itself for nesting.

If 'encoded' is TRUE it is up to the caller to ensure that 'value' is either entity-encoded or CDATA-escaped. Using this option is not recommended when working with untrusted user input, since failing to escape the data c