RE: document is not an element, is it?

There is an open issue proposed on whether item? should be item* or not.

We have anySimpleType?=anySimpleType* (since we do not have lists of
lists) and anyType? = anyType*. So if you want to make anyType a subtype
of item then you better have the equivalence item?=item*.

Best regards
Michael

> -----Original Message-----
> From: Todd A. Mancini [mailto:todd.mancini@daxat.com]
> Sent: Monday, March 10, 2003 14:36 PM
> To: 'Jonathan Robie'; 'MW'; public-qt-comments@w3.org
> Subject: RE: document is not an element, is it?
> 
> 
> >At 06:04 PM 3/9/2003 +0100, MW wrote:
> >>Hi Jonathan!
> >>
> >>In the working draft "XQuery 1.0: An XML Query Language" in chapter
> "4.5
> >>Function Definitions" there is this example:
> >>define function depth($e as element) as xs:integer
> >>{
> >>   {-- An empty element has depth 1 --}
> >>   {-- Otherwise, add 1 to max depth of children --}
> >>   if (empty($e/*)) then 1
> >>   else max(for $c in $e/* return depth($c)) + 1
> >>}
> >>depth(document("partlist.xml"))
> >>
> >>But this function does not run in GALAX. And I think it is obvious
> that
> >>the function must not work, because the funktion-parameter is
declared
> 
> >>as  "element", but it is called with a parameter of type "document".
I
> 
> >>think the declaration must be changed  from "element" to "item".
> 
> >Right, that's a bug in the spec.
> 
> Just to keep everything clear, and I cannot speak for GALAX, but isn't
> 'node*' the return type of the document() function, not the 'document'
> type?  The 'document' type results from computed document
constructors,
> not calls to the document() function.
> 
> Furthermore, would it not be a static type error to rewrite the
function
> so that the argument type is 'item' rather than 'element', as was
> suggested?  'node*' is not a subtype of 'item' (but 'item*' would be
> valid, as would, of course, 'node*', which is what I would recommend
for
> the argument type).
> 
> 	-Todd
> 

Received on Monday, 10 March 2003 17:47:03 UTC