3 namespace Consolidation\OutputFormatters\StructuredData\Xml;
6 * When using arrays, we could represent XML data in a number of
9 * For example, given the following XML data strucutre:
11 * <document id="1" name="doc">
48 * The challenge is more in going from an array back to the more
49 * structured xml format. Note that any given key => string mapping
50 * could represent either an attribute, or a simple XML element
51 * containing only a string value. In general, we do *not* want to add
52 * extra layers of nesting in the data structure to disambiguate between
53 * these kinds of data, as we want the source data to render cleanly
54 * into other formats, e.g. yaml, json, et. al., and we do not want to
55 * force every data provider to have to consider the optimal xml schema
58 * Our strategy, therefore, is to expect clients that wish to provide
59 * a very specific xml representation to return a DOMDocument, and,
60 * for other data structures where xml is a secondary concern, then we
61 * will use some default heuristics to convert from arrays to xml.
63 interface XmlSchemaInterface
66 * Convert data to a format suitable for use in a list.
67 * By default, the array values will be used. Implement
68 * ListDataInterface to use some other criteria (e.g. array keys).
70 * @return \DOMDocument
72 public function arrayToXml($structuredData);