[xquery-talk] incomplete results
mrys at microsoft.com
Wed Dec 1 09:13:43 PST 2004
There is one situation where you can get a static error:
1. If you have a static typing implementation and
2. The data you query is typed with a schema that has a closed content
3. The path expression's type inference infers empty().
Then a statically typed implementation raises a type error since the
path does not exist...
> -----Original Message-----
> From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On
> Of Michael Kay
> Sent: Wednesday, December 01, 2004 8:17 AM
> To: 'Cindy Girard'; talk at xquery.com
> Subject: RE: Re: [xquery-talk] incomplete results
> > I was expecting an error if I tried to
> > return an attribute that wasn't there.
> A path expression such as @a returns the empty sequence if the context
> has no @a attribute.
> This obviously makes sense with elements: ./author returns a sequence
> nodes if there are two authors, one node if there is one author, zero
> if there are no authors. Attributes are just handled the same way. If
> weren't the case you wouldn't be able to do if(@a) to test if the
> exists - this is simply a test for whether the sequence returned by @a
> empty or not.
> Michael Kay
> talk at xquery.com
More information about the talk