On Mon, May 26, 2014 at 10:00:20AM +0200, Bart Wagenaar wrote:

> Hello Dave,
> 
> I just ran into another possible bug. When using an 'any' object, it will
> never set its value.
> In the object it goes into the 'buildChildren' method:
> 
> def buildChildren(self, child_, node, nodeName_, fromsubclass_=False):
> >     obj_ = self.gds_build_any(child_, 'DT_RootElementType')
> >     if obj_ is not None:
> >         self.set_anytypeobjs_(obj_)
> 
> 
> The 'self.gds_build_any' function always returns None, so the if-statement
> is always false. Meaning the 'anytypeobjs_' variable always remains empty.
> 
> I have attached an example xsd file + the generated python file (generateDs
> 2.12c).

Bart,

Good to hear from you again.

OK.  So, let me see if I understand this and whether I can explain
it.

Method gds_build_any is an empty stub.  It's purpose is to enable a
gDS user to add code that builds whatever content might be in
his/her XML instance documents as specified by xs:any.  But, because
the XML Schema used xs:any to specify child content and does *not*
specify what type of children can occur at that location, there is
no way for gDS to know how to generate the code to build those
children.

And, so, the intention is to enable the user to create and use a
customized version of the class GeneratedsSuper, in which the stub
method gds_build_any is defined.  Note the import statement and the
try:except: immediately before class GeneratedsSuper in the
generated code.

If you do have an XML schema that contains xs:any specifications of
child content, then what you will need to do is:

1. Copy and paste the generated definition of class GeneratedsSuper
   into a file named generatedssuper.py.

2. Modify the definition of gds_build_any so that it builds whatever
   child instances occur in your XML instance documents.

3. When you run or import that generated code, make sure that your
   module generatedssuper.py is somewhere that Python can import it.

You can find a little additional help here:

- http://www.davekuhlman.org/generateDS.html#support-for-xs-any

- http://www.davekuhlman.org/generateDS.html#overridable-methods

Hope this helps.  Please let me know if/when you have more questions
or suggestions.

Dave

-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to