Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xs:key and nesting

From: George Cristian Bina <george@---------.--->
To: richard.liu@---.---
Date: 2/16/2006 1:51:00 PM
Hi Richard,

This looks to me like a bug in Xerces 2.7.1.
I will check that against the current Xerces SVN snapshot to see if it 
shows the same problem and let you know.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


richard.liu@u... wrote:
> I have the following schema:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     targetNamespace="http://www.ubs.com/namespace/wbml-render"
>     xmlns:wbr="http://www.ubs.com/namespace/wbml-render"
>     xmlns="http://www.ubs.com/namespace/wbml-render"
> elementFormDefault="qualified"
>     attributeFormDefault="unqualified">
>     <xs:complexType name="footnoteExplanation">
>         <xs:annotation>
>             <xs:documentation>The text explaining the
> footnote.</xs:documentation>
>         </xs:annotation>
>         <xs:simpleContent>
>             <xs:extension base="xs:string"/>
>         </xs:simpleContent>
>     </xs:complexType>
>     <xs:complexType name="footnote">
>         <xs:annotation>
>             <xs:documentation>Composed of base and
> explanation.</xs:documentation>
>         </xs:annotation>
>         <xs:sequence>
>             <xs:element name="footnoteBase" type="footnoteBase"/>
>             <xs:element name="footnoteExplanation"
> type="footnoteExplanation" minOccurs="0"/>
>         </xs:sequence>
>         <xs:attribute name="footnoteId" type="xs:NMTOKEN"
> use="optional"/>
>         <xs:attribute name="footnoteRef" type="xs:NMTOKEN"
> use="optional"/>
>     </xs:complexType>
>     <xs:complexType name="footnoteBase" mixed="true">
>         <xs:annotation>
>             <xs:documentation>The text to which the footnote
> pertains.</xs:documentation>
>         </xs:annotation>
>         <xs:sequence>
>             <xs:element ref="footnote" minOccurs="0"
> maxOccurs="unbounded"/>
>         </xs:sequence>       
>     </xs:complexType>
>     <xs:element name="footnote" type="footnote">
>         <!--<xs:key name="ref_or_explanation">
>             <xs:selector xpath="."/>
>             <xs:field xpath="wbr:footnoteExplanation | @footnoteRef"/>
>         </xs:key>-->
>     </xs:element>
>     <xs:element name="para">
>         <xs:complexType mixed="true">
>             <xs:sequence>
>                 <xs:element ref="footnote" minOccurs="0"
> maxOccurs="unbounded"/>
>             </xs:sequence>
>         </xs:complexType>
>         <xs:key name="ref_or_explanation">
>             <xs:selector xpath=".//wbr:footnote"/>
>             <xs:field xpath="wbr:footnoteExplanation | @footnoteRef"/>
>         </xs:key>
>     </xs:element>
> </xs:schema>
> 
> and the following XML schema instance
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <wbr:para xmlns:wbr="http://www.ubs.com/namespace/wbml-render"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://www.ubs.com/namespace/wbml-render
>  
> file:/Users/richard/Documents/Work/Accessibility/Schemas/test_footnote.x
> sd"> Now is 
>     <wbr:footnote footnoteRef="abc">
>         <wbr:footnoteBase>the</wbr:footnoteBase>
>         <!--<wbr:footnoteExplanation>As Clinton said, "It depends on
> what you mean by 'the'."</wbr:footnoteExplanation>-->
>     </wbr:footnote> for 
>     <wbr:footnote>
>         <wbr:footnoteBase>
>             <wbr:footnote>
>                 <wbr:footnoteBase>
>                     <wbr:footnote footnoteRef="x22">
>                         <wbr:footnoteBase>all</wbr:footnoteBase>
>                     </wbr:footnote> good
>                 </wbr:footnoteBase>
>                 <wbr:footnoteExplanation>In some inner
> sense.</wbr:footnoteExplanation>
>             </wbr:footnote> men
>         </wbr:footnoteBase>
>         <wbr:footnoteExplanation>Good women,
> too.</wbr:footnoteExplanation>
>     </wbr:footnote>
> </wbr:para>
> 
> The xs:key on the para element is supposed to ensure that each footnote
> descendant has either a footnoteExplanation child or a footnoteRef
> attribute.  The first footnote child of para "works" as desired (in
> Oxygen 7, i.e., Xerces):  Uncommenting the footnoteExplanation element
> results in an error, as does deleting the footnoteRef attribute.
> 
> The second footnote element is rather complicated, because the model
> permits "nesting" footnotes.  The XML seems valid:  The second footnote
> element has a footnoteExplanation and no footnoteRef, so does its first
> footnote descendent, and the innermost footnote has a footnoteRef
> attribute and no footnoteExplanation.
> 
> Nevertheless, I receive the following two error messages (I've pasted
> the offending statement after the Location):
> 
> SystemID:
> /Users/richard/Documents/Work/Accessibility/Schemas/test_footnote.xml
> Location: 18:88
>                 <wbr:footnoteExplanation>In some inner
> sense.</wbr:footnoteExplanation>
> Description: E Identity constraint error:  field
> "./wbr:footnoteExplanation|@footnoteRef" matches more than one value
> within the scope of its selector; fields must match unique values.
> 
> SystemID:
> /Users/richard/Documents/Work/Accessibility/Schemas/test_footnote.xml
> Location: 21:76
>         <wbr:footnoteExplanation>Good women,
> too.</wbr:footnoteExplanation>
> Description: E Identity constraint error:  field
> "./wbr:footnoteExplanation|@footnoteRef" matches more than one value
> within the scope of its selector; fields must match unique values.
> 
> Can anybody tell me what I'm missing?
> 
> Thanks,
> Richard
> 

From george@o... Thu Feb 16 17:18:20 2006
Received: from lisa.w3.org ([128.30.52.41])
	by frink.w3.org with esmtp (Exim 4.50)
	id 1F9mlo-00063w-BQ
	for xmlschema-dev@lis


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent