xml - Enforcing XSD key and keyref constraints is not working well with a recursive schema definition -


I use the XSD's and lt; Xs: key & gt; I am trying to implement the key and context constraints in my custom XML format. and & lt; Xs: keyref & gt; element is not working because I like it.

Example example of my XML format:

   Uses & lt; Item name = "y" use = "z" /> & Lt; Item name = "z" /> & Lt; Box & gt; & Lt; Item name = "p" = "q" /> Uses & Lt; Item name = "q" uses = "r" /> & Lt; Item name = "r" /> & Lt; Box & gt; & Lt; / Box & gt; & Lt; / Box & gt; & Lt; / Box & gt; & Lt; / Cell & gt;  

This figure describes a "room" in it with a "box". A box can contain items and other boxes. The box can also be empty. Items in a box have different names (but can share a name with the items in the other box), and only other items in the same box can use "only".

I am trying to maintain the integrity of the "use" graph by using key / keyrefs on the appropriate / special properties. However, when I use the Xerces 2 validator on this XML, the schema below I get the following error:

  [error] file: ///example.xml: 13: 11: cvc- detection-barrier.4.3: element identified 'box' The key for the barrier was not found with the 'Q' key 'Madkierf'. [Error] File: ///example.xml: 14: 9: cvc-identity-constraint.4.3: The key 'Madkierf' was not found with the value 'Y' for the detection of the element 'box'.  

Schema:

  & lt; Xs: schema xmlns: xs = "http://www.w3.org/2001/XMLSchema" xmlns: example = "http: //example.com" targetNamespace = "http://example.com" elementFormDefault = "qualified "AttributeFormDefault =" ineligible "& gt; & Lt; Xs: element name = "room" type = "example: cell" /> & Lt; X: complex type name = "cell" & gt; & Lt; XS: All & gt; & Lt; Xs: element riff = "example: box" /> & Lt; / XS: All & gt; & Lt; / XS: complexType & gt; & Lt; Xs: element name = "box" type = "example: box" & gt; & Lt; Xs: keyref name = "ItemKeyRef" reference = "example: item" & gt; & Lt; Xs: Selector xpath = "./ Example: Item" /> & Lt; Xs: field xpath = "use @" /> & Lt; / XS: keyref & gt; & Lt; Xs: keyname = "itemkey" & gt; & Lt; Xs: Selector xpath = "./ Example: Item" /> & Lt; Xs: field xpath = "@ name" /> & Lt; / XS: key & gt; & Lt; / XS: element & gt; & Lt; X: complex type name = "box" & gt; & Lt; Xs: like minOccurs = "0" maxOccurs = "unbounded" & gt; & Lt; Xs: element name = "item" type = "example: item" /> & Lt; Xs: element riff = "example: box" /> & Lt; / XS: Options & gt; & Lt; / XS: complexType & gt; & Lt; X: complex type name = "item" & gt; & Lt; Xs: attribute name = "name" type = "x: string" = "required" /> & Lt; Xs: attribute name = "use" type = "x: string" /> & Lt; / XS: complexType & gt; & Lt; / XS: Schema & gt;  

I think I am doing something wrong. Why am I getting this error? Should not it be valid?

I've found that Xerces2 Java Parser 2.11.0 I uses recursive element definitions and key / keyrefs There are some bugs in time use when I tried to validate XX using Oxygen XML Developer, it succeeded, so I believe the bug report is accurate.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -