I'm working on an XML library, that can create / parse xml's from arrays/jsons. I managed to write the parser with xml_parser (and google help :p) cause SimpleXML wasn't good enough for what I'm doing.
I've managed to create an array that looks something like that:
Array
(
[flow] => Array
(
[math] => Array
(
[apply] => Array
(
[lt] => Array
(
)
[apply] => Array
(
[divide] => Array
(
)
[apply] => Array
(
[minus] => Array
(
)
)
)
[otherStuff] => 0
)
)
[true] => Array
(
)
[true_attr] => Array
(
[xsi:type] => SomeStuff
[id] => 2
)
)
[flow_attr] => Array
(
[id] => 0
[xmlns:xsi] => http://www.w3.org/2001/XMLSchema-instance
)
)
As you can see, it should look something like this ( not the best example :p ):
<flow id="0">
<math>
<lalaa/>
<appyl>
</apply>
</math>
</flow>
Note that empty arrays should end with /> for example , and so on
As you can see I separated the node it self to node_attr that contains the attrs of the nodes. Like flow_attr, true_attr.
Anyone have an idea how to convert this array back to xml? I'm just lost and don't know what to do.
Thanks for the help!