> From: Bernd Kiefer <kie...@dfki.de>
> Sent: Wednesday, November 9, 2011 3:15 AM
> 



> i've problems converting the given schema. The root element (Resource)
> does not show up anywhere in the generated code, and thus,
> parsing only gives my an empty myString element. I used the following
> command to generate test.py
> 
> python generateDS.py -f -a "" \
>       --namespacedef='xmlns:ms="http://www.dfki.de/testschema"; 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> targetNamespace="http://www.dfki.de/testschema"; 
> elementFormDefault="qualified" attributeFormDefault="unqualified"' \
>       -o test.py \
>       testschema.xsd
> 
> omitting `-a ""' or using `-a "ms:"' also did not help.
> 

Bernd -

OK. I'll admit I had to think about this for awhile before I came up
with an answer.  And I *think* it's the answer that we want.

That <xs:element> declaration at the top level is telling us that an
element whose tag is "Resource" can occur at top level, but that it's
class is ResourceType.  So we do not need to generate a Resource
class, only a ResourceType class.   Take a look at the parse()
function in the generated code.  You will notice that it is trying
to parse an element whose tag is "Resource" and turning it into a
instance of the Python class ResourceType, which is what we want, I
believe.

So, it's generating what you want, I think, or at least it's
generating what the testschema.xsd says you want.  It's generating
Python code and Python classes (data bindings) that will parse an
XML instance document containing a "Resource" element at top level
and will turn that top level element into an instance of class
ResourceType.

In general, we generate Python classes for xs:complexType
declarations, but not for xs:element declarations.

Please let me know if you disagree or have more questions.

- Dave


 
-- 


Dave Kuhlman
http://www.rexx.com/~dkuhlman

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to