> From: Detecca Detecca

>Sent: Sunday, February 10, 2013 6:35 AM
> 
> Hello,
> 
> My goal is to use generateDS to create python data structures for
> the following schema:
> 
> http://www.spiritconsortium.org/XMLSchema/SPIRIT/1.5
> 
> I successfully installed generateds-2.8b-py2.7.egg, w/ lxml, and
> perform the following steps:
> 
> Process include files for the top level file:
> > process_includes.py index.xsd indexinc.xsd
> 
> Run generateDS:
> 
> D:\ipxact\schema\spirit_1.5>generateDS.py -f -o index.py -s indexsubs.py 
> indexinc.xsd
> 
> The script fails with the error below.
> 
> Any insight into the problem would be greatly appreciated.
> 

Mike -

Thanks for reporting this.

I was able to download the Spirit schema files, and I was able
reproduce that error.  I get the same error message that you get.

After poking around a bit, I found that those schema files reference
an attributeGroup named "spirit:long.att" that is not defined.  I
don't know why it is not defined, perhaps we're missing a file.

generateDS.py definitely needs to be able to handle that in a more
graceful and informative way.

So, I've made a patch.  Basically, with this patch, we're ignoring
any attributeGroup reference to an undefined attributeGroup.  So,
we're saying, in effect, that when the author of a schema references
an attributeGroup, but does not define that attributeGroup, s/he
intends that attributeGroup to be empty.  Does that seem reasonable?

An alternative would be to write out an error message (something
like "attributeGroup 'XYZ' missing"), and quit.  I think it's better
to be able to generate the python bindings/classes.  Or, I could
write out a warning message, but in the case of the Spirit Schema,
this would result in over 70 warning messages.  So, I'll leave out
the warning message.  What do you think?

With this patched version, I was able to generate output.

I'll send a new version containing this patch in a separate email.

Let me know how well this works for you.  And, as always, hope this
helps.

- Dave

> 
> Traceback (most recent call last):
>   File "C:\Python27\Scripts\generateDS.py", line 5, in <module>  
>pkg_resources.run_script('generateDS==2.8b', 'generateDS.py')
>   File "C:\Python27\lib\site-packages\pkg_resources.py", line 499, in 
>run_script self.require(requires)[0].run_script(script_name, ns)
>   File "C:\Python27\lib\site-packages\pkg_resources.py", line 1239, in 
>run_script execfile(script_filename, namespace, namespace)
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 5446, in <module> main()
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 5440, in main processIncludes, superModule=superModule)
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 5170, in parseAndGenerate root.annotate()
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 788, in annotate self.fix_dup_names()
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 1136, in fix_dup_names child.fix_dup_names()
>   File 
>"c:\python27\lib\site-packages\generateds-2.8b-py2.7.egg\EGG-INFO\scripts\generateDS.py",
> line 1124, in fix_dup_names name = attr.getName()
> AttributeError: 'NoneType' object has no attribute 'getName'
> 


--


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

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to