> From: Rodrigo Moraes

> Sent: Sun, September 12, 2010 6:40:36 PM
> 
> Hi there,
> I was glad to find this tool. Works very well and saved me a lot of
> time. I've found 2 small issues and here's a simplified example to
> reproduce them:
> 
>     http://paste.pocoo.org/show/261259/
> 
> To reproduce it, generate the classes using the XSD in the first
> snippet. Then parse the XML in the second snippet and export the
> resulting object. The result will be what you see in the third
> snippet:
> 
> 1) The exported root tag is wrong: it uses the element type instead of the 
>name.
> 2) The empty element got a 'None' content.
> 
> I fixed issue 2 patching quote_xml():
> 
> def quote_xml(inStr):
>     if not inStr:
>         return ''
>     #...

Rodrigo -

Thanks for this fix.  I've added it.  It will be in the next
version that I upload.

> 
> But after hacking around I couldn't find a fix for issue 1. Maybe I'm
> doing something wrong, or are these real issues?

The code generated by generateDS.py, specifically the parse()
function, is looking at the top level (outer-most) element in the
instance doc and trying to determine the tag and the element type. 
When the tag and element type (name) are different, it does not
have the information that it needs to get this right.  So, two
comments:

1. I'll look into it.  Your sample code will be very helpful with
   this.

2. You might want to consider writing your own parse() function. 
   In your application, you are the one who knows what the top
   level tag and element type is. Consider putting your parse function and
   application specific code in a separate module (your
   application) and, in that module, import the generated classes.

> 
> Thanks for the awesome work on this library. It is very useful. :)

Great.  I'm glad it helped.  And, thanks for the compliment.

Again, thanks for the feed-back and the fix.  They are helpful.

- Dave


 -- 

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

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to