W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

XSV crash caused by bad keys?

From: Stuart Brown <sepenidur@hotmail.com>
Date: Thu, 09 Jan 2003 10:08:59 +0000
To: xmlschema-dev@w3.org
Message-ID: <F1027WD84jBtwuieeh500001bc6@hotmail.com>

Hi there,

This may be a keys problem; I don't quite have my head round them yet. 
Basically, a Schema which previously worked fine causes XSV to crash when I 
insert keys.

Here is a (much reduced) version of my Schema:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="doc">
  <xsd:complexType>
   <xsd:sequence>
    <!-- A chunk of irrelevant metadata elements removed -->
    <xsd:element name="article">
     <xsd:complexType>
      <xsd:sequence>
       <!-- Elements removed -->
       <xsd:element name="body" minOccurs="0">
        <xsd:complexType>
         <xsd:choice maxOccurs="unbounded">
          <xsd:element name="p" type="pType"/>
          <!-- Elements removed -->
	 </xsd:choice>
        </xsd:complexType>
       </xsd:element>
      </xsd:sequence>
     </xsd:complexType>
    </xsd:element>
    <xsd:element name="references">
     <xsd:complexType>
      <xsd:sequence>
       <xsd:element name="reference" maxOccurs="unbounded">
        <xsd:complexType>
         <xsd:simpleContent>
          <xsd:extension base="xsd:string">
           <xsd:attribute name="id" type="xsd:ID" use="required"/>
	  </xsd:extension>
	 </xsd:simpleContent>
	</xsd:complexType>
       </xsd:element>
      </xsd:sequence>
     </xsd:complexType>
    </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
  <xsd:key name="artRefs">
   <xsd:selector xpath="./references/reference"/>
   <xsd:field xpath="@id"/>
  </xsd:key>
  <xsd:keyref name="refToArtRefs" refer="artRefs">
   <xsd:selector xpath=".//bib-ref"/>
   <xsd:field xpath="@refid"/>
  </xsd:keyref>
</xsd:element>

<xsd:complexType name="pType" mixed="true">
  <xsd:choice minOccurs="0" maxOccurs="unbounded">
   <xsd:element name="bib-ref">
    <xsd:complexType>
     <xsd:simpleContent>
      <xsd:extension base="xsd:string">
       <xsd:attribute name="refid" type="xsd:IDREF"/>
      </xsd:extension>
     </xsd:simpleContent>
    </xsd:complexType>
   </xsd:element>
   <!-- Lots of elements removed -->
  </xsd:choice>
</xsd:complexType>

</xsd:schema>

Before the keys were present (and I was relying on ID/IDREF), everything 
worked fine, but now with the keys when I try to XSV a document against my 
full schema, I get:

<?xml version='1.0'?>
<xsv xmlns='http://www.w3.org/2000/05/xsv' crash="true" docElt="{None}doc"
     instanceAssessed="true" instanceErrors="0" rootType="[Anonymous]"
     schemaDocs="extenza.xsd" schemaErrors="0"
     target="file:/c:/run/output/foo.xml" validation="strict"
     version="XSV 2.1-1 of 2002/11/25 10:37:14">
  <schemaDocAttempt URI="file:/c:/run/output/foo.xsd" outcome="success"
                    source="command line"/>
  <bug>validator crash during validation</bug>
</xsv>
Traceback (most recent call last):
  File "<string>", line 95, in ?
  File "<string>", line 92, in parseAndRun
XSV.driver.SchemaValidationError: Traceback (most recent call last):
  File "d:\work\XMLinter\nschema\XSV\driver.py", line 302, in runit
  File "d:\work\XMLinter\nschema\XSV\validate\validateElement.py", line 31, 
in validate
  File "d:\work\XMLinter\nschema\XSV\validate\validateElement.py", line 146, 
in validateElement
  File "d:\work\XMLinter\nschema\XSV\validate\validateKey.py", line 48, in 
validateKeys
  File "d:\work\XMLinter\nschema\XSV\validate\validateKey.py", line 146, in 
validateKeyRefs
TypeError: list objects are unhashable

I should stress that I have only included the above schema to check that in 
general I have placed the key/keyrefs correctly for scoping; if anyone wants 
to see the real thing for comment, I can send it to them off-list.

So my question is, have I placed my keys/keyrefs correctly? If yes, can 
someone give me a general idea as to why XSV might crash like that; if no 
could someone tell me what I'm doing wrong please?[*]

Cheers,

Stuart

[*] Preferably in words of one syllable. My brain seems to involuntarily 
suspend all activity the minute it reaches the keys bit of the spec...

_________________________________________________________________
The new MSN 8 is here: Try it free* for 2 months 
http://join.msn.com/?page=dept/dialup
Received on Thursday, 9 January 2003 05:09:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT