W3C home > Mailing lists > Public > public-qt-comments@w3.org > February 2004

[FO] Bug in contains()

From: Jonathan Robie <jonathan.robie@datadirect.com>
Date: Thu, 12 Feb 2004 18:52:53 -0500
Message-ID: <402C11D5.1010801@datadirect.com>
To: Michael Rys <mrys@microsoft.com>
Cc: Michael Kay <mhk@mhk.me.uk>, Jonathan Robie <jonathan.robie@datadirect.com>, XML Query Comments <public-qt-comments@w3.org>

As currently specified, fn:contains() raises a type error for elements 
of complex type with complex content.  Suppose I have the following element:

<people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:noNamespaceSchemaLocation="file:///c:/temp/foo.xsd">
    <person>Michael Kay</person>
    <person>Jonathan Robie</person>
    <person>Michael Rys</person>
</people>

Which is governed by the following schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified">
  <xs:element name="people">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="person"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="person" type="xs:string"/>
</xs:schema>

Now I want to do the following query:

    let $people := doc('people.xml')
    return contains($people, "Rys")

When the query attempts to cast $people to a string, it will try to 
atomize the element using dm:typed-value(), and the following rule applies:

     If the node has a complex type with complex content, raises a
     type error, which may be handled by the host language.

We should see if there are other functions/operators that have this same 
problem.

Jonathan
Received on Thursday, 12 February 2004 18:55:24 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:57 UTC