[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] MicroXPath proposal
- From: Liam R E Quin <liam@w3.org>
- To: John Cowan <johnwcowan@gmail.com>
- Date: Thu, 13 Jan 2011 22:01:13 -0500
On Thu, 2011-01-13 at 01:12 -0500, John Cowan wrote:
> I've been thinking a lot about MicroXML, MicroXSD, MicroRNG, etc., and
> I thought I'd take a stab at a MicroXPath. This is intended to be,
> like the others, the simplest thing that could possibly work.
> However, I'm not a frequent XPath user, so I may have put together
> something that is *too* simple to work.
I think you have to ask why people use XPath.
Pretty much on a daily basis people ask me how to use XPath to...
* find an element with a given attribute value
* find the partNumer attribute of an element containing a particular
string (or of all such elements)
* find all sibling elements of a given match (most often, preceding or
following siblings, e.g. trying to match an HTLM "section" delimited
by h_n_ elements)
* match HTML class attributes (requires concat() and contains())
* match any HTML heading (h1|h2|...) - XPath 1 wasn't entirely
orthogonal in its use of parens, so (//a)|(//b) might be allowed and
not //(a|b)/c for example, although I can never remember the exact
rules,since I mostly use XPath 2.
Mind you, most days someone asks me why their XPath expression doesn't
match, and it's almost always a namespace problem :-)
> One principle is that since elements are the only kind of node in the
> MicroXPath data model, XPath expressions return only lists of
> elements.
I think people will want lists of attributes too. But maybe that doesn't
make the 80/20 cut, and I admit I don't really have a good feel for who
would be using this XPath derivative. In Web browsers, people often
seem to use XPath to avoid the DOM.
> Another is that 100% compatibility with XPath 1.0 isn't
> essential, since most XPath expressions are fairly transient compared
> to XML documents or schemas.
Even when used in links with the xpointer scheme? (if anyone uses that)
And, what about compatibility with the current version of XPath?
Much (not all) of what was added in XPath 2 was to meet users' needs.
Of course, people say that of any large "second system", but it does
seem a little odd to ignore a decade's work. Is microXPath intended as a
foundation for microXSLT based on the 1998 version of XSLT? At any rate,
the ability to return non-nodes was a much-asked-for thing; the general
trend seemed to be to want the language to be simpler, in having fewer
odd quirks, and more flexible. The type system and a few other added
features ended up making it noticeably larger, but there's good in there
too...
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]