Hi,
Currently, anything using the import statement (from the XML schema)
is subject to name clashes between the existing target namespace and
the one that gets imported.
I don't have a specific case where this happened yet, but I wanted to
plant some ideas and see how people like them.
Based on my reading about the import statement, the mechanism is to
import the contents of a different schema file, attach it to a
different namespace (by specifying its target namespace as the
"namespace" attribute in the import statement, and attaching a
namespace prefix to that same namespace), and then referring to it
using the namespace prefix. I.e.
<xs:schema
targetNamespace="http://schemas.dmtf.org/ovf/envelope/1"
xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common">
<xs:import namespace="http://schemas.dmtf.org/wbem/wscim/1/common"
schemaLocation="http://schemas.dmtf.org/wbem/wscim/1/common.xsd"/>
<xs:element name="Version" type="cim:cimString" minOccurs="0"/>
</xs:schema>
Here, in the top=level xs:schema node we attach the cim prefix to the
namespace that we designate in the namespace attribute of xs:import.
One idea to prevent the clash: when generating classes for a namespace
that is different than the existing target namespace, make them part
of a different Python namespace. One way to achieve this could be:
class CIM(object):
class cimString(GeneratedsSuper):
subclass = None
superclass = None
...
class cimBoolean(GeneratedsSuper):
subclass = None
superclass = None
...
After that, referring to cimString would have to be done as CIM.cimString
For the purposes of the following, I will call the CIM class in the
previous example a "python namespace class".
We could keep a mapping of namespaces to python namespace classes, and
make generateDS no longer ignore the namespace prefix, but do
something useful with it.
Does this sound reasonable?
Mihai
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
generateds-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/generateds-users