XML Schema: 1) two levels of schemas and 2) code complete
Posted: Fri Aug 27, 2004 7:47 pm
Hello!
Background: My overall goal is to develop XML Schema (http://control.ee.ethz.ch/~rohliko/xml/ ... MMFFMM.xsd) for domains-specific XML Schemas (e.g. http://control.ee.ethz.ch/~rohliko/xml/ ... CSR.schema). I tried to follow the hints given in the article at http://www.xml.com/pub/a/2002/10/02/metaschema.html. However, I found it difficult to express what I need using the <xs:redefine> element. Therefore I decided first to do the job by modifying directly the (errated) XML Schema definition (from http://www.w3.org/2001/XMLSchema.xsd ... thanks to george for pointing me there). Other references to my prevouis problem is at http://www.oxygenxml.com/forum/ftopic556.html (now solved, thanks).
What I did is that I introduced new attribute to the <xs:complexType> element -- the attribute is called "displayType" and can have six different values. An exemple of this can be seen in FeatureMetamodelCSR.schema. This file is valid against XMLSchemaOfMMFFMM.xsd. Now the strange thing: When I open new file that I want to validate against ("valid") FeatureMetamodelCSR.schema and write the following code ...
... I get two kind of strange errors. First I get 26 errors concerning the displayType attribute. How it is possible if the FeatureMetamodelCSR.schema itself was validated? Second I get two contradicting errors concerning the name attribute. This errors can be removed by specifying the mmffmm prefix to this attribute, but since there is a default namespace which is the same as the namespace with prefix "mmffmm" there should be no difference, right?
The third question I would like to discuss with others is whether you have some experience with creating schemas for schemas (and also using these schemas) -- i.e exactly the same thing that I describe here. I am fighting it for several week and still do not know how to put things together ... and google has no answers ;-(. Does anybody has some examples or samples that he can share with me? I would be grateful.
The previos question was quite general. Now I have very concrete one. If you write character "<" (less then) right after the closing tag of "FeatureModel" element (just cut and paste the code above) and let the Oxygen make its code complete function (select the first option "FeatureNode") it inserts the following:
Fourth questions is: What is this? Why there are two prefixes (oXygen1 and oXygen2) for the same namspece, which is BTW the default namespace and also the namespace with prefix "mmffmm"? Moreover, the oXygen1 prefix is used twice for the same namespace (more precisely, it is redefined in the child element). Why Oxygen doesn't offer "mmffmm" or none prefix?
I will appreciate any help from you. Many thanks in advance!
Best regards,
Ondrej
Background: My overall goal is to develop XML Schema (http://control.ee.ethz.ch/~rohliko/xml/ ... MMFFMM.xsd) for domains-specific XML Schemas (e.g. http://control.ee.ethz.ch/~rohliko/xml/ ... CSR.schema). I tried to follow the hints given in the article at http://www.xml.com/pub/a/2002/10/02/metaschema.html. However, I found it difficult to express what I need using the <xs:redefine> element. Therefore I decided first to do the job by modifying directly the (errated) XML Schema definition (from http://www.w3.org/2001/XMLSchema.xsd ... thanks to george for pointing me there). Other references to my prevouis problem is at http://www.oxygenxml.com/forum/ftopic556.html (now solved, thanks).
What I did is that I introduced new attribute to the <xs:complexType> element -- the attribute is called "displayType" and can have six different values. An exemple of this can be seen in FeatureMetamodelCSR.schema. This file is valid against XMLSchemaOfMMFFMM.xsd. Now the strange thing: When I open new file that I want to validate against ("valid") FeatureMetamodelCSR.schema and write the following code ...
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<FeatureModel name="InstanceOfICSR"
xmlns="http://www.pnp-software.com/fmt/fm"
xmlns:mmffmm="http://www.pnp-software.com/fmt/fm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.pnp-software.com/fmt/fm FeatureMetamodelCSR.schema">
</FeatureModel>
The third question I would like to discuss with others is whether you have some experience with creating schemas for schemas (and also using these schemas) -- i.e exactly the same thing that I describe here. I am fighting it for several week and still do not know how to put things together ... and google has no answers ;-(. Does anybody has some examples or samples that he can share with me? I would be grateful.
The previos question was quite general. Now I have very concrete one. If you write character "<" (less then) right after the closing tag of "FeatureModel" element (just cut and paste the code above) and let the Oxygen make its code complete function (select the first option "FeatureNode") it inserts the following:
Code: Select all
<FeatureNode xmlns:oXygen1="http://www.pnp-software.com/fmt/fm" oXygen1:name="">
<MultipleCardinality xmlns:oXygen1="http://www.pnp-software.com/fmt/fm" oXygen1:cardMin="" xmlns:oXygen2="http://www.pnp-software.com/fmt/fm" oXygen2:cardMax=""/>
</FeatureNode>
I will appreciate any help from you. Many thanks in advance!
Best regards,
Ondrej