pabigot / pyxb

Python XML Schema Bindings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NamespaceUniquenessError in elementDeclaration

gokulvenkats opened this issue · comments

commented

pyxb.exceptions_.NamespaceUniquenessError: http://cp.com/rules/client: name national_credit_file used for multiple values in elementDeclaration

I even tried archive-path and archive-to-file but it is not working for NamespaceUniquenessError in elementDeclaration.

Is NamespaceUniquenessError for elementDeclaration and typeBinding different?

I can imagine this might happen if you generate bindings for multiple schema in separate calls to pyxbgen. You might need to do something like this.

commented

I can imagine this might happen if you generate bindings for multiple schema in separate calls to pyxbgen. You might need to do something like this.

Hi,

Still I face the same issue, copied the complete error below:

$ /opt/pypy3-v6.0.0/bin/pypy3 /opt/pypy3-v6.0.0/bin/pyxbgen --version
pyxbgen from PyXB 1.2.5

$ /opt/pypy3-v6.0.0/bin/pypy3 /opt/pypy3-v6.0.0/bin/pyxbgen \

--schema-location=/tmp/CPRulesOrderSchema.xsd --module=cporder
--schema-location=/tmp/CPRulesResultSchema.xsd --module=cporder.result
--module-prefix=lexisnexis
--archive-to-file=lexisnexis/lexisnexis.core.wxs

Traceback (most recent call last):
File "/opt/pypy3-v6.0.0/bin/pyxbgen", line 52, in
generator.resolveExternalSchema()
File "/opt/pypy3-v6.0.0/site-packages/pyxb/binding/generate.py", line 2661, in resolveExternalSchema
uri_content_archive_directory=self.uriContentArchiveDirectory())
File "/opt/pypy3-v6.0.0/site-packages/pyxb/xmlschema/structures.py", line 4825, in CreateFromLocation
return cls.CreateFromDocument(pyxb.utils.utility.DataFromURI(schema_location, archive_directory=uri_content_archive_directory), **kw)
File "/opt/pypy3-v6.0.0/site-packages/pyxb/xmlschema/structures.py", line 4804, in CreateFromDocument
return cls.CreateFromDOM(domutils.StringToDOM(xmls, **kw), **kw)
File "/opt/pypy3-v6.0.0/site-packages/pyxb/xmlschema/structures.py", line 4873, in CreateFromDOM
rv = schema.__processTopLevelNode(cn)
File "/opt/pypy3-v6.0.0/site-packages/pyxb/xmlschema/structures.py", line 5052, in __processTopLevelNode
return self._addNamedComponent(component.CreateFromDOM(node, **kw))
File "/opt/pypy3-v6.0.0/site-packages/pyxb/xmlschema/structures.py", line 5078, in addNamedComponent
return tns.addCategoryObject('elementDeclaration', nc.name(), nc)
File "/opt/pypy3-v6.0.0/site-packages/pyxb/namespace/init.py", line 346, in addCategoryObject
raise pyxb.NamespaceUniquenessError(self, '%s: name %s used for multiple values in %s' % (self, local_name, category))
pyxb.exceptions
.NamespaceUniquenessError: http://cp.com/rules/client: name national_credit_file used for multiple values in elementDeclaration

I would need to see the schema to figure out what's going on. However, I see you're using PyXB 1.2.5. Please update to the latest release (1.2.6) first to see whether this problem has been solved.