OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] [XPath] is it legal ?

[ Lists Home | Date Index | Thread Index ]
  • To: Michael Kay <mike@saxonica.com>
  • Subject: Re: [xml-dev] [XPath] is it legal ?
  • From: Philippe Poulard <Philippe.Poulard@sophia.inria.fr>
  • Date: Fri, 07 Apr 2006 19:34:39 +0200
  • Cc: xml-dev@lists.xml.org
  • In-reply-to: <200604071604.k37G46hU006271@sophia.inria.fr>
  • References: <200604071604.k37G46hU006271@sophia.inria.fr>
  • User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050511

Michael Kay wrote:
> The only kind of XPath expressions that Saxon attempts to evaluate in
> streaming mode are the limited path expressions used in XML Schema integrity
> constraints - basically downwards-only selections with no predicates. It
> wouldn't be hard to add a few extra features such as constant numeric
> predicates or predicates that test the values of attributes. 

Trivial :)

The more
> general case is pretty difficult. There have been some research papers on
> the topic, but I think most of them fail to tackle the difficult cases such
> as a predicate of [last()-2] 

I'll try to support it

or a step of preceding-sibling::x[2].

...but not this one ; only things that have not yet been read have a 
chance to be resolved (however, a smart strategy that would accumulate 
datas that would matches all candidate patterns could work ; I'll keep 
things simple).

> course that's the luxury of doing research, you can leave the difficult
> problems as a reason for applying for a further grant...)

>>I don't want to design a language similar to XPath that works on a
>>different data model, but rather design a data model different to 
>>XPath's on which XPath can be applied :)
>>Why couldn't I design a data model where the value of an attribute is 
>>not a string but any object ?
> Well, obviously if the data model changes then the semantics change, so it's
> a different language.

I'm trying to design a data model that preserves the semantic in the aim 
to keep calling the language XPath.

> XPath 2.0 does in fact recognize that the value of an attribute can be a
> typed value such as a list of integers. But it doesn't allow the value of an
> attribute to be, say, an XML element, or an employee.

if the list of integers represent ID of employees, why "my:empIDs" 
couldn't be the type and employee[] the typed data ?

>>For the moment, there are few things that I bypassed in XPath :
>>-it is said somewhere that :
>>   -any object can be bound to a variable.
>>   -the result of an XPath expression is either a (possible 
>>empty) node 
>>set, a boolean, a string, or a number.
> This is so 1990s... You're talking XPath 1.0.

Yes :)

>>   If my XPath expression is $foo, why is it not allowed to get the 
>>original object ? Thus, I consider that it is possible to get 
>>an object.
> XSLT (more specifically than XPath) recognizes that vendors can extend the
> type system to allow XPath values that encapsulate external objects,
> typically as the result of extension functions. This is unchanged in 2.0.
> It's a big step from allowing such things in XPath variables to allowing
> them as the typed value of an element or attribute - but not necessarily an
> impossible one. I think I prefer a model where the attribute holds a URI and
> the URI can be dereferenced to get the external object.
>>-comparisons on comparable objects are not done regarding the XPath 
>>rules, but on their comparator ; this is also the same when a 
>>typed data 
>>is bound to a node (I know there are similar mechanisms in 
>>XPath 2.0.), 
>>like shown in this example :
>>     http://reflex.gforge.inria.fr/tutorial.html#N8013D5
>>     ...which works like PSVI on W3C XML Schema, but I don't 
>>think that 
>>the type in this example can be defined with WXS (in order to 
>>sort it in the same way).
> I'm not sure what you're trying to say here.

The way to compare objects in XPath 1.0 is dedicated to objects found in 
the data model (nodeset, string, boolean, numbers), not others.

>>Now, let's consider again the question about objects contained in 
>>attribute values : with PSVI, it is possible to bind a typed 
>>data with 
>>it. So, I can consider that the attribute value is a 
>>(textual) reference 
>>that will be parsed by my type library that will supply the object 
>>expected. We like to be contortionists in computer science, 
>>but I prefer 
>>a straightforward way to get a result almost identical 
>>(without needing 
>>to design a useless string value as a reference to my 
>>object). This is 
>>like setting anonymous objects : if I don't care about the name (the 
>>textual reference), why forcing me to use one ?
> I think it's a mistake to forget XML's origins as a markup language. XML in
> my view is fundamentally text, and that is its great strength. 

This is so 1990s... ;)

Some objects are not suitable for text representation :
-because they are too big : it would become a bottleneck,
-because they are already present as objects : transforming them to XML 
and parsing them back to DOM with some typed data would be very useless
-because it is senseless : what is the text representation of an 
InputStream or an OutputStream ? (I'm not talking about the data-flow 
that is read from or write into, but on the I/O-Stream as an object)

When I designed the Web module for Active Tags (which is almost the same 
as the servlet model), I've had 2 choices :
-making the (yet another) "HTTP Markup Language", and serializing the 
requests to it then parsing it back to DOM
-directly use the HTTPServletRequest object and exposes it as something 
that looks like a node
I thanks myself to have choosen the 2nd.

IMHO, the low-level view of XML is text, but the high-level view is no 
longer ; if we have a high-level view, it is not obliged to get it from text

Data types
> are merely a way of creating higher-level views of the underlying text. If
> you want to build trees of arbitrary objects, there are better ways of doing
> it than bending XML.

Using XML technologies to handle them is probably not the better way, 
but a good way anyway, and it might be the best way in certain cases ; 
XPath is not the sole tool, there are also XUpdate-like instructions to 
update them ; so, there is a common way to act on XML objects and 
non-XML objects. This is what I did in Active Tags.

> Michael Kay
> http://www.saxonica.com/


              (. .)
|      Philippe Poulard       |
        Have the RefleX !


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS