[html-formfu] Config with Config::Any::XML

Carl Franks fireartist at gmail.com
Fri Nov 13 19:49:17 GMT 2009


2009/11/13 David Schmidt <davewood at gmx.at>:
> Hello list,
>
> I am trying to configure my forms with Config::Any::XML but I cannot
> get the correct XML syntax.
>
> So far I tried loading a working Config::Any::General sample file and
> compare it to my Config::Any::XML file but I just cant model anonymous
> array references in XML. :)
>
> I want XML because I am dynamically creating the form config with XSLT
> from a XML file and I want to stick to XML for everything
>
> I include the form.conf and form.xml files and how Config::Any loads
> them into perl structures.
>
> thanks in advance
>
> david
>
> *** form.conf:
> <elements>
>    type   Text
>    label   Label1
> </elements>
> <elements>
>    type   Text
>    label   Label2
> </elements>
> indicator   submit
>
> *** conf2perl
> $VAR1 = [
> {
>    './form.conf' => {
>        'elements' => [
>        {
>            'label' => 'Label1',
>                'type' => 'Text'
>        },
>        {
>            'label' => 'Label2',
>            'type' => 'Text'
>        }
>        ],
>            'indicator' => 'submit'
>    }
> }
> ];
>
> *** form.xml
> <?xml version="1.0"?>
> <form>
>    <elements>
>    <element type="Text">
>            <label>Label1</label>
>    </element>
>    <element type="Text">
>            <label>Label2</label>
>    </element>
>    </elements>
>    <indicator>submit</indicator>
> </form>

Hi,
This seems to do the trick:

<?xml version="1.0"?>
<form>
   <elements type="Text">
           <label>Label1</label>
   </elements>
   <elements type="Text">
           <label>Label2</label>
   </elements>
   <indicator>submit</indicator>
</form>

Cheers,
Carl



More information about the HTML-FormFu mailing list