Re: Question about uniqueness

Eddie Robertsson <erobertsson@allette.com.au> writes:

> >
> >
> >>Hmm, I just tested this with the following instance and schema
> >>(basically the same as you with the element declaration filled in)
> >>
> 
> >
> >Hey, you removed the default namespace from my schema... if you add it back,
> > duplicates are detected.
> 
> Oops, sorry about that.
> Actually, XML Spy is the only one that now picks up on the duplicate
> key. MSXML and XSV are still silent (which I think is correct)
> 
> 
> >But default namespaces shouldn't apply to XPath
> >expressions, or should they?
> >
> No. Not unless W3C XML Schema changes this behaviour somehow but I'm
> fairly certain that's not the case. Does anyone else have any comments
> on this?

W3C XML Schema did not change XPath expression semantics, so you
_must_ use prefixes to match qualified names.

I should have clarified that in my example I removed the namespace
declaration from the instance - - it was faster that way.

But adding it back in properly and XSV still finds the errors:

site.xsd:
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:foo">
<element name="Site" type="anyType">
		<unique name="idName">		
			<selector xpath=".//*"/>
			<field xpath="@name"/>
		</unique>
</element>
</schema>

site.xml:
<Site xmlns="urn:foo">

<Home name="CorHome">
		<Topic name="Your_Needs">
			<View name="Choice_1"/>
			<View name="CorHome"/>
			<View name="Your_Needs2"/>
		</Topic>
		<Topic name="Your_Needs2">
			<View name="Choice_3"/>
			<View name="Choice_4"/>
			<View name="Choice_3"/>
		</Topic>
		<Topic name="Your_Needs"/>
	</Home>
	</Site>

> xsv site.xml site.xsd
<?xml version='1.0'?>
<xsv xmlns='http://www.w3.org/2000/05/xsv' xmlns:xml='http://www.w3.org/XML/1998/namespace' docElt='{urn:foo}Site' instanceAssessed='true' instanceErrors='4' rootType='anyType' schemaDocs='site.xsd' schemaErrors='0' target='/projects/ltg/users/ht/xml/xmlschema/monk/site.xml' validation='strict' version='XSV 1.1 of 2002/06/28 09:39:17'>
  <schemaDocAttempt URI='/projects/ltg/users/ht/xml/xmlschema/monk/site.xsd' outcome='success' source='command line'/>
  <invalid char='4' code='cvc-identity-constraint.2.1.2' line='6' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml'>duplicate key CorHome for {urn:foo}idName, first appearance was in unnamed entity at line 3 char 1 of file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml</invalid>
  <invalid char='3' code='cvc-identity-constraint.2.1.2' line='9' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml'>duplicate key Your_Needs2 for {urn:foo}idName, first appearance was in unnamed entity at line 7 char 4 of file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml</invalid>
  <invalid char='4' code='cvc-identity-constraint.2.1.2' line='12' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml'>duplicate key Choice_3 for {urn:foo}idName, first appearance was in unnamed entity at line 10 char 4 of file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml</invalid>
  <invalid char='3' code='cvc-identity-constraint.2.1.2' line='14' resource='file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml'>duplicate key Your_Needs for {urn:foo}idName, first appearance was in unnamed entity at line 4 char 3 of file:///projects/ltg/users/ht/xml/xmlschema/monk/site.xml</invalid>
</xsv>

Compilation finished at Thu Sep 12 09:31:41

-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2002, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
 [mail really from me _always_ has this .sig -- mail without it is forged spam]

Received on Thursday, 12 September 2002 04:33:07 UTC