Using XPath 2.0 Within Schema
Posted: Wed Jul 25, 2007 12:25 am
Hi
I hope someone can help.
I am currently running Oxygen 7.2.
I am writing a schema which uses key and keyref.
Most of the XPath I use in the "selector" works fine, however when using slightly more complex XPath I get the following error message: "is not valid with respect to the XPath subset supported by XML schema",
Here is an made up example of the problem I am having:
<farm>
<animal type="dog">
<food>
Dog Food
<food/>
</animal>
<animal type="cat">
<food>
Cat Food
<food/>
</animal>
</farm>
<xs:key name="animal_food">
<xs:selector xpath="farm/animal/food"/>
</xs:key>
The key above causes no problems.
<xs:key name="animal_type">
<xs:selector xpath="farm/animal[@type='dog']"/>
</xs:key>
The "animal_type" key above causes the "not valid with respect to the XPath subset supported by schema", error.
I have searched various forums and not found the solution. The problem can be one of the following:
1 - XSD Schema only supports a subset of XPath 1.0. Where can I find the subset of XPath 1.0 supported?
2 - XSD Schema only supports a subset of XPath 2.0. Where can I find the subset of XPath 2.0 supported?
3 - XSD Schema fully supports all XPath 2.0. I'm therefore guessing I need to either:
a - Change a setting in Oxygen so the correct Schema validator is used. The only thing I could find under "Preferences" in the "XML Parser" section is, "Schematron XPath Version". I have selected 2.0. However this made no difference.
b - I'm using MSXML.NET, should I change the parser I am using?
c - Do I need to upgrade to Oxygen version 8?
d - The schema version I am using is http://www.w3.org/2001/XMLSchema. Should I change this?
I have had conflicting advice regarding this issue. However the majortiy suggest that the limiting subset of XPath issue is not a problem with later versions of schema. However no one is certain what I need to do to resolve the problem described in Oxygen. Any suggestion would be greatly appreciated.
Many Thanks
Parmy
I hope someone can help.
I am currently running Oxygen 7.2.
I am writing a schema which uses key and keyref.
Most of the XPath I use in the "selector" works fine, however when using slightly more complex XPath I get the following error message: "is not valid with respect to the XPath subset supported by XML schema",
Here is an made up example of the problem I am having:
<farm>
<animal type="dog">
<food>
Dog Food
<food/>
</animal>
<animal type="cat">
<food>
Cat Food
<food/>
</animal>
</farm>
<xs:key name="animal_food">
<xs:selector xpath="farm/animal/food"/>
</xs:key>
The key above causes no problems.
<xs:key name="animal_type">
<xs:selector xpath="farm/animal[@type='dog']"/>
</xs:key>
The "animal_type" key above causes the "not valid with respect to the XPath subset supported by schema", error.
I have searched various forums and not found the solution. The problem can be one of the following:
1 - XSD Schema only supports a subset of XPath 1.0. Where can I find the subset of XPath 1.0 supported?
2 - XSD Schema only supports a subset of XPath 2.0. Where can I find the subset of XPath 2.0 supported?
3 - XSD Schema fully supports all XPath 2.0. I'm therefore guessing I need to either:
a - Change a setting in Oxygen so the correct Schema validator is used. The only thing I could find under "Preferences" in the "XML Parser" section is, "Schematron XPath Version". I have selected 2.0. However this made no difference.
b - I'm using MSXML.NET, should I change the parser I am using?
c - Do I need to upgrade to Oxygen version 8?
d - The schema version I am using is http://www.w3.org/2001/XMLSchema. Should I change this?
I have had conflicting advice regarding this issue. However the majortiy suggest that the limiting subset of XPath issue is not a problem with later versions of schema. However no one is certain what I need to do to resolve the problem described in Oxygen. Any suggestion would be greatly appreciated.
Many Thanks
Parmy