> Hello Dave,
> 
> we are currently using generateDS to generate databindings in a code
> generation application.
> 
> So far it has proven very helpful and easy to use, so thanks a lot
> for creating it :).

Florian,

You are welcome.  I'm glad it has been useful.  I appreciate the
comment.

> 
> We recently made some modifications to our base xml-schema to try
> attribute references instead of multiple attribute definitions of
> the same kind.
> 
> When using attribute references, generateDS will not cast the
> resulting python object to the specified data type of the
> xml-argument referenced.
> 
> It will do so though for the explicitly specified xml-argument. The
> same goes for element references as far as I can tell.
> 
> I have attached a small schema example which has an element example
> as well as an attribute example, to run through generateDS.
> 
> The resulting class has None-Datatype for the references and integer
> for non-referenced versions.
> 
> Maybe you can give me your opinion on the matter. I'm only just
> starting to get to know the details of XML-Schema, so I cant really
> tell if this is intentional behavior or not.

I used generateDS.py to generate a module from your XML schema
reference_test.xsd.  You are right.  Code is generated to validate
attribute test_normal_attr during parsing; and no validation code is
generated for attribute test_ref_attr.

I also created an XML instance document (attached) which follows
your XML schema *except* that the value of test_ref_attr is not an
integer.  Then I used xmllint to validate that document:

    $ xmllint -noout -schema reference_test.xsd test01.xml 
    test01.xml:2: element dummy: Schemas validity error : Element 'dummy', 
attribute     'test_ref_attr': 'aaa' is not a valid value of the atomic type 
'xs:integer'.
    test01.xml fails to validate

So, we know two things:

1. generateDS.py does not support validation of that referenced
   attribute.  Specifically, it does not generate code that
   validates in while parsing the instance doc.

2. xmllint says it should be validated.

I'm currently working on enhancements to the validation of simple
types defined with xs:simpleType.  So, I'll add this issue to my
list.  I'm not sure how long this will take.  It might be easy; it
might be complicated.

I'll keep you informed.  And, thanks for the report.

Dave


> 
> Thanks in advance & Best Regards
> Florian

-- 

Dave Kuhlman
http://www.davekuhlman.org
<?xml version="1.0" encoding="UTF-8"?>
<dummy test_ref_attr="aaa" test_normal_attr="222">
    <test_ref_element>123</test_ref_element>
    <test_normal_element>456</test_normal_element>
</dummy>
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to