Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
You should add a "Config" global element declaration to config.xsd:
<xsd:element name="Config" type="config:Config"/>
Doing this, however, will cause all your instance documents to fail when loading. The reason is because the instance documents currently use xsiNoNamespaceSchemaLocation as a hack to make it work without the "proper" global element defined:
<Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</Config>
The xsi:noNamespaceSchemaLocation needs to be removed and replace with xmlns="http:///org.apache.tuscany.das.rdb/config.xsd" instead.
One more change, to make it all work properly, is that you need to add elementFormDefault="qualified" in config.xsd, otherwise the nested elements won't be found when loading.
To summarize, you need to add elementFormDefault and global element to config.xsd. With these changes config.xsd should look something like this:
<xsd:schema
xmlns:config="http:///org.apache.tuscany.das.rdb/config.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http:///org.apache.tuscany.das.rdb/config.xsd"
elementFormDefault="qualified">
<xsd:element name="Config" type="config:Config"/>
<xsd:complexType name="Config">
...
All the instance files, e.g., CompanyConfig.xml, need to be changed so that the root element uses xmlns instead of xsi:noNamespaceSchemaLocation. The instance documents should all look something like this:
<Config xmlns="http:///org.apache.tuscany.das.rdb/config.xsd">
...
</Config>