eclipse plugin default schema association

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Peter
Posts: 2
Joined: Thu Dec 29, 2005 3:35 pm

eclipse plugin default schema association

Post by Peter »

I'm having a problem related to the example at http://www.oxygenxml.com/forum/viewtopi ... =3939#3939.

The example is working fine if I try it but I would like to avoid the hardcoded paths in the schemaLocation attributes. Suppose the test.xml file would not have the schemaLocation attributes in the a&b elements:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<t:test xmlns:t="test">
<a:a xmlns:a="a" a="1"/>
<a:b xmlns:a="b" b="2"/>
</t:test>
I would like oxygen to find the needed schemas via the default schema association settings in Windows->preferences->oXygen->Editor->Default Schema Association. I've added the following entries:
  • Namespace=test
    Root local name=test
    File name=<ANY>
    Schema type=XML Schema
    Schema URI=(path to test.xsd)

    Namespace=a
    Root local name=a
    File name=<ANY>
    Schema type=XML Schema
    Schema URI=(path to a.xsd)

    Namespace=b
    Root local name=b
    File name=<ANY>
    Schema type=XML Schema
    Schema URI=(path to b.xsd)
However, this doesn't work.
The validation fails with:
The matching wildcard is strict, but no declaration can be found for element 'a:a'.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
The matching wildcard is strict, but no declaration can be found for element 'b:b'.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
The strange thing is that test.xsd is found but a.xsd and b.xsd not.
Can somebody enlighten me?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: eclipse plugin default schema association

Post by george »

Hi Peter,
Peter wrote:...
Namespace=a
Root local name=a
File name=<ANY>
Schema type=XML Schema
Schema URI=(path to a.xsd)

Namespace=b
Root local name=b
File name=<ANY>
Schema type=XML Schema
Schema URI=(path to b.xsd)
[/list]
....
As you see above, the default schema association is based on the root local name and root namespace. Your a:a and a:b elements are not root elements so they will not be used for finding a schema.

What you can do however is to create a schema for the test namespace that imports the schemas for the a and b namespaces. The simplest thing is to have a new schema document that includes the test.xsd and imports a.xsd and b.xsd and use that instead of test.xsd for the test namespace in the default schema association settings.

I hope that helps.
Happy holidays,
George
Peter
Posts: 2
Joined: Thu Dec 29, 2005 3:35 pm

Post by Peter »

Hi George,

i've followed your advice and it's working exactly as you said it would.
Thanks a lot & enjoy the holidays!
Post Reply