Hi Dave,

I’m using the XML Signature Schema (http://www.w3.org/2000/09/xmldsig#) imported and used inside another schema (http://openadr.org/oadr-2.0b/2012/07) to create a “signed object”.  I’m running into a problem with the namespace that is generated for one element within the XML Signature.  Everything else looks fine but this one element, which should get associated with the XML Digital Signature namespace is instead getting tagged with the surrounding namespace.  The XSD look fine:


<element name="Reference" type="ds:ReferenceType"/>
<complexType name="ReferenceType">
<sequence>
<element ref="ds:Transforms" minOccurs="0"/>
<element ref="ds:DigestMethod"/>
<element ref="ds:DigestValue"/>
</sequence>
<attribute name="Id" type="ID" use="optional"/>
<attribute name="URI" type="anyURI" use="optional"/>
<attribute name="Type" type="anyURI" use="optional"/>
</complexType>

The DigestValue element is associated with the ‘ds’ namespace just like Transforms and DigestMethod, but the generated code for this element looks different.

def exportChildren(self, outfile, level, namespace_='oadr:', name_='ReferenceType', fromsubclass_=False, pretty_print=True):
if pretty_print:
eol_ = '\n'
else:
eol_ = ''
if self.Transforms is not None:
self.Transforms.export(outfile, level, namespace_='ds:', name_='Transforms', pretty_print=pretty_print)
if self.DigestMethod is not None:
self.DigestMethod.export(outfile, level, namespace_='ds:', name_='DigestMethod', pretty_print=pretty_print)
if self.DigestValue is not None:
showIndent(outfile, level, pretty_print)
outfile.write('<%sDigestValue>%s</%sDigestValue>%s' % (namespace_, self.gds_format_base64(self.DigestValue, input_name='DigestValue'), namespace_, eol_))
Notice that both Transforms and DigestMethod are exported with namespace_=‘ds:’ but for some reason, DigestValue is exported with the default namespace for exportChildren which in this case is namespace=‘oadr:’.  The generated code looks similar if I process only the XML Signature XSD but in this case, the default namespace is ‘ds:’ so it generates correctly.

I’ve tried unsuccessfully to isolate just a portion of the XSD to make this happen but haven’t been able to do it.  I’m attaching the XML Signature XSD which can be used to generate code that will exhibit the behavior described above. I’m happy to experiment further if you can’t point me in the right direction ;-)

BTW, I am able to work around the issue by hand editing the generated code and replacing namespace_ with ‘ds:’.

-Bob


Attachment: xmldsig-core-schema.xsd
Description: Binary data





Kisensum | 344 Thomas Berkley Way #260 | Oakland, CA, 94612

------------------------------------------------------------------------------
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