[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [jfw] Bringing the forms package up to scratch



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.

I'm for renaming the `Registry\Format\Xml` to `Registry\Format\XmlValues` or something that's not so misleading. See https://github.com/joomla/joomla-framework/pull/287


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?

Adam Bouqdib


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.

--
Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to a topic in the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/joomla-dev-framework/ASBkHvanpOA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.

--
Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.