Hi. I've just started on this and I'm not sure I understand the issue... What's wrong with parsing the XML like this:
public function stringToObject($data, array $options = array())
{
// Parse the XML string.
$xml = simplexml_load_string($data);
$obj = json_decode(json_encode($xml));
return $obj;
}
That way we have a real representation of the XML data and it makes it easy to create a form from this. I'm not too keen on the attributes being inside @attributes, but that can easy be changed by recursively looping through the object.
To determine what format this should be saved as it would be good to agree on how non XML forms should be. I personally quite like the idea of loading a JSON string like this:
{"fields":[
{"label":"Test","type":"text","name":"test","required":true},
{"label":"Test2","type":"text","name":"test2"}
]}
On Thursday, 13 March 2014 10:59:16 UTC+1, piotr_cz wrote:
I don't think an XML object can be simply converted to Registry. If we would manage to do so, I'm afraid it would be easier to manipulate XMLDocument than Registry result.
On Wednesday, March 12, 2014 5:36:55 PM UTC+1, Adam Bouqdib wrote:
Ah I see. I'll have a closer look at that first then. If I update the XML package of Registry should I report back here or just create a pull request?
On 12 March 2014 17:29, Don Gilbert
<dilber... AT gmail.com> wrote:
Main issue was the XML support in Registry. It doesn't use clear semantic markup. Instead of <form><fieldset><field name="foo"></fieldset></form> it uses <node name="form"><node name="fieldset">etc</node></node> - It's not a good representation of the data.