RE: Wrong with Path and my suggestion about PathExpr,esp. literals.

Phenix,

You are right. This is a known bug in the XQuery specification that the
constraint that path expressions should only work on nodes is too
restrictive.

Making literals outside of path expressions would not be sufficient.
There are problems with variables and other kinds of path expressions. 

We are currently considering several ways to solve that issue.
This will be fixed in future versions of the documents.

Thanks for your interest in XQuery,
- Jerome

> -----Original Message-----
> From: Phenix Shieh [mailto:phenix_shieh@hotmail.com] 
> Sent: Thursday, April 11, 2002 8:02 AM
> To: www-xml-query-comments@w3.org
> Subject: Wrong with Path and my suggestion about PathExpr,esp. literals.
> 
>  
> 
>    For example,if we want to analyse this XQuery:
> 
> "a"="b"
> 
>    We hope that we will get the result of a boolean value TRUE.But in the FS,the parsing tree is(for "a" only):
> 
> Expr->PathExpr->RelativePathExpr->StepExpr->GeneralStep->PrimaryExpr->Literal->StringLiteral="a"
> 
>    Then do normalization as the FS told us:
> 
> [PathExpr]==[RelativePathExpr]==[StepExpr]==[GeneralStep]
> 
>    Because of these rules:
> 
> 
> [PrimaryExpr]Path  
> == 
> typeswitch [PrimaryExpr]Expr as $fs:new 
>   case node* return $fs:new 
>   default return dm:error() 
>  
> 
>   
> [PrimaryExpr StepQualifiers]Path  
> == 
> [[PrimaryExpr]Path StepQualifiers]ForwardPath  
> 
>    The simple string "a" will be normalized to:
> 
> ---------------------------------------------
> 
>   typeswitch "a" as $fs:new 
> 
>      case node* return $fs:new
> 
>      default return error()
> 
> ---------------------------------------------
> 
>    If as the FS told us,we will get the ERROR though surely it is not.
> 
>    Anyway,this is wrong!So I think why not separate the Literals from the normalization rule?
> 
>    My suggestion is that separate the literals form the path expression and as a standalone expression.This means that we should modify the XQuery Grammar slightly:when parsing,let the Literals have a higher priority,so a simple literal will not be recognised as a path expr.
> 
>  
> 
> 
>   _____  
> 
> 从网站得到更多信息。MSN Explorer 免费下载:http://explorer.msn.com/lccn
> 
> 

Received on Thursday, 11 April 2002 12:34:25 UTC