[Xml-compile] Problem to write repeatable blocks
Alex Bernier
alex.bernier at free.fr
Tue Sep 10 12:20:49 GMT 2013
On Tue, Sep 10, 2013 at 12:57:38PM +0200, Mark Overmeer wrote:
> * Alex Bernier (alex.bernier at free.fr) [130910 10:40]:
> > On Tue, Sep 10, 2013 at 12:11:09PM +0200, Mark Overmeer wrote:
> > > The attached script demonstrates that it works when your data-structure
> > > is correct. You forgot the cho_multipleChoiceQuestion level.
> >
> > Thank you very much.
> >
> > Regarding the syntax : I don't understand clearly why the
> > "inputQuestion" elements should be included in a variable called
> > "cho_multipleChoiceQuestion". Why "cho_inputQuestion => \@questions"
> > produces invalid code ?
>
> You should not (try to) think ;-) $wsdl->template(PERL => $type)
> produces what is expected, and you should follow that.
>
> The problem is your nested <choice> does not have a name. The XML
> structure can not be mapped to a perl structure without a name, so
> X::C constructs a name based on the first element inside the choice.
> multipleChoiceQuestion is the name of the first element, hence
> cho_multipleChoiceQuestion is the name of the choice block. Even
> if you only put other elements in there.
Thanks !
>
> > Another question : which syntax should I use to produce output like
> > <do:label xml:lang="en"> instead of <do:label lang="en"> ?
>
> When you use a schema, you use schema data-types, so I do not expect
> to see xml:lang where we have an xsd:language type. However, it is
> possible... I see this:
>
> <xs:element name="label">
> <xs:complexType>
> <xs:sequence>
> ...
> </xs:sequence>
> <xs:attribute ref="xml:lang" use="required"/>
>
> So, you "lang" parameter will get taken. Whether the attribute is
> included as 'lang' or 'xml:lang' depends on the attributeFormDefault
> of the schema.
>
> Your xml.xsd does not say attributeFormDefault="qualified", so it
> defaults to "unqualified". Old schema's often do not have these
> *FromDefault lines in them, because they were added as syntax later.
> You can fix that when loading the schema:
>
> $wsdl->importDefinitions('xml.xsd'
> , attribute_form_default => 'qualified'
> );
I patched the line (see attached file) but still get lang="en" and not xml:lang="en" as output. Did I miss something ?
Regards,
Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t2.pl
Type: text/x-perl
Size: 1295 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20130910/a72ecbc1/t2.pl
More information about the Xml-compile
mailing list