You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org> on 2005/03/30 00:49:52 UTC

[jira] Resolved: (XMLBEANS-38) Does not support xs:key (keyRef NoIllegalEntries)

     [ http://issues.apache.org/jira/browse/XMLBEANS-38?page=history ]
     
Radu Preotiuc-Pietro resolved XMLBEANS-38:
------------------------------------------

     Resolution: Invalid
    Fix Version: unspecified

This, in fact, works as designed, it seems that XMLSpy is wrong.
According to http://www.w3.org/TR/xmlschema-1/#d0e13819, clause 4.3, the key has to be in the same subtree as the keyref for it to be succesfully found, which doesn't happen in your example.
If you move your keyref up one level, it will work.

> Does not support xs:key (keyRef NoIllegalEntries)
> -------------------------------------------------
>
>          Key: XMLBEANS-38
>          URL: http://issues.apache.org/jira/browse/XMLBEANS-38
>      Project: XMLBeans
>         Type: Bug
>     Versions: Version 1, Version 2, Version 1.0.3, Version 2 Beta 1
>  Environment: Linux J2SEE 1.4.1_05
>     Reporter: Drew Kurry
>     Assignee: Radu Preotiuc-Pietro
>      Fix For: unspecified

>
> XMLBeans does not support the <xs:key name=""> feature used in XSD Schema.  I have tried multiple schemas using this feature and when I go to validate an XML document, I get the same error:
> Key '<the-name-of-your-key' not found (keyRef NoIllegalEntries)
> I am sure this is valid syntax as XML Spy and other editors are ok with the key ref tag as this is supported within XSD.  
> I have included a sample XSD and XML document that includes these values.
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> 	<xsd:element name="supermarket">
> 		<xsd:complexType>
> 			<xsd:sequence>
> 				<xsd:element name="aisle" maxOccurs="unbounded">
> 					<xsd:complexType>
> 						<xsd:sequence>
> 							<xsd:element name="item" maxOccurs="unbounded">
> 								<xsd:complexType>
> 									<xsd:simpleContent>
> 										<xsd:extension base="xsd:string">
> 											<xsd:attribute name="code" type="xsd:positiveInteger"/>
> 											<xsd:attribute name="quantity" type="xsd:positiveInteger"/>
> 											<xsd:attribute name="price" type="xsd:decimal"/>
> 										</xsd:extension>
> 									</xsd:simpleContent>
> 								</xsd:complexType>
> 							</xsd:element>
> 						</xsd:sequence>
> 						
> 						<!-- Attribute Of Aisle -->
> 						<xsd:attribute name="name" type="xsd:string"/>
> 						<xsd:attribute name="number" type="xsd:positiveInteger"/>
> 					     <!-- Of Aisle -->
> 					
> 					</xsd:complexType>
> 					
> 					<xsd:keyref name="NoIllegalEntries" refer="itemKey">
> 						<xsd:selector xpath="item"/>
> 						<xsd:field xpath="@code"/>
> 					</xsd:keyref>
> 				</xsd:element>
> 				<xsd:element name="items">
> 					<xsd:complexType>
> 						<xsd:sequence>
> 							<xsd:element name="item" maxOccurs="unbounded">
> 								<xsd:complexType>
> 									<xsd:simpleContent>
> 										<xsd:extension base="xsd:string">
> 											<xsd:attribute name="code" type="xsd:positiveInteger"/>
> 										</xsd:extension>
> 									</xsd:simpleContent>
> 								</xsd:complexType>
> 							</xsd:element>
> 						</xsd:sequence>
> 					</xsd:complexType>
> 				</xsd:element>
> 			</xsd:sequence>
> 			<xsd:attribute name="name" type="xsd:string"/>
> 		</xsd:complexType>
> 		<xsd:key name="itemKey">
> 			<xsd:selector xpath="items/item"/>
> 			<xsd:field xpath="@code"/>
> 		</xsd:key>
> 	</xsd:element>
> </xsd:schema>
> ***********************
> and sample XML
> ***********************
> <?xml version="1.0" encoding="UTF-8"?>
> <!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy.com)-->
> <supermarket xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\tmp\Supermarket.xsd" name="String">
> 	<aisle name="String" number="2">
> 		<item code="1234" quantity="2" price="3.1415926535897932384626433832795">String</item>
> 	</aisle>
> 	
> 	<items>
> 		<item code="1234">Java</item>
> 	</items>
> </supermarket>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org