Hi,

I am using generateDS to parse an XML Signature.  When I attempt to parse the 
signature XML, I encounter an error in a buildChildren method:

$ python xmldsig.py sig.xml
Traceback (most recent call last):
  File "xmldsig.py", line 3511, in <module>
    main()
  File "xmldsig.py", line 3504, in main
    parse(args[0])
  File "xmldsig.py", line 3420, in parse
    rootObj.build(rootNode)
  File "xmldsig.py", line 796, in build
    self.buildChildren(child, node, nodeName_)
  File "xmldsig.py", line 816, in buildChildren
    obj_.build(child_)
  File "xmldsig.py", line 1845, in build
    self.buildChildren(child, node, nodeName_)
  File "xmldsig.py", line 1879, in buildChildren
    obj_ = X509Data.factory()
NameError: name 'X509Data' is not defined

It appears that the generated code is using the element name (‘X509Data’) when 
it should be using the type/class name (‘X509DataType’).  If I regenerate the 
code with this switch:

$generateDS —fix-type-names “X509DataType:X509Data” xmldsig.xsd

It parses correctly. The schema is here:  
https://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd 
<https://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd> 
and the relevant bits are:


<complexType name="KeyInfoType" mixed="true">
<choice maxOccurs="unbounded">
...
<element ref="ds:X509Data"/>
...
<any processContents="lax" namespace="##other"/>
<!--  (1,1) elements from (0,unbounded) namespaces  -->
</choice>
<attribute name="Id" type="ID" use="optional"/>
</complexType>
...
<!--  Start X509Data  -->
<element name="X509Data" type="ds:X509DataType"/>
<complexType name="X509DataType">
<sequence maxOccurs="unbounded">
<choice>
...
</choice>
</sequence>
</complexType>

I don’t understand why the generated code is calling X509Data.factory() instead 
of X509DataType.factory().  X509DataType is the name of the class in the 
generated py file.

Is this a bug or is there something unusual in the XSD that causes this?  Is 
the —fix-type-names switch a proper work around?

Thanks in advance for any help.

-Bob

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to