[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: MicroXPath proposal

  • From: James Clark <jjc@jclark.com>
  • To: John Cowan <johnwcowan@gmail.com>
  • Date: Sat, 15 Jan 2011 09:58:58 +0700

Re:  MicroXPath proposal
My two satang's worth on this is that XPath 1.0 is already fairly micro.  For me (and I am admittedly biased) the natural MicroXPath is XPath 1.0, with its namespace treatment adjusted to be consistent with whatever MicroXML does.  For example, if MicroXML takes the approach of allowing prefixes but not giving any special meaning to namespace declarations, then MicroXPath would just match prefixes and treat namespace declarations as attributes.  In fact, since XPath 1.0 is defined in terms of its data model, this adjustment can (all/mostly?) be handled by specifying an appropriate mapping from the MicroXML data model to the XPath 1.0 data model, without changing the semantics of XPath 1.0 itself.

XPath 1.0 isn't hard to implement; the challenge is more in making it efficient.  I would guess the most inconvenient part is the namespace axis, and adjusting MicroXPath to match the MicroXML treatment of namespaces would hopefully get rid of that.

XPath 1.0 can already express inherited attributes; it would be nice to have a simpler way of doing this, but once you open the door to extensions, it's hard to know where to draw the line.

The only subset of XPath 1.0 that makes sense to me is one that has the goal of being able to create one path that uniquely identifies any element (and perhaps attribute) in a document. Something like

  /foo[2]/bar[1]/baz[3]

But this subset would useful in only a small subset of the cases in which XPath 1.0 is useful.

James

On Thu, Jan 13, 2011 at 1:12 PM, John Cowan <johnwcowan@gmail.com> 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.  So I'm posting here for
comments.  (I'm using this address because xml-dev drops posting from
my permanent cowan@ccil.org address on the floor, for some reason).

One principle is that since elements are the only kind of node in the
MicroXPath data model, XPath expressions return only lists of
elements.  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.

So here's what I've got.  The only kind of expression is a location
path.  Location paths can be absolute or relative, and their steps can
be separated by either / or //.  A path step is an element name, star,
dot, or dot-dot.

Only one predicate is allowed per step, and it has to take one of
these eight forms:

1)      a literal number

2)      last()

3)      location-path="string"

4)      @name="string"

5)      location-path/@name="string"

6)      @@name="string"

7)      location-path/@@name="string"

8)      function(.)

@@ means "inheritable attribute", and is provided for brevity and
convenience.  In form 8, the function name is provided externally to
XPath (there are no built-in functions except last()), and accepts the
current element node and returns a boolean value.  This is the
programmatic escape from MicroXPath that allows complex predicates.

What's missing?  What can I take out?  Comments solicited.

--
John Cowan       http://www.ccil.org/~cowan        <cowan@ccil.org>
      You tollerday donsk?  N.  You tolkatiff scowegian?  Nn.
      You spigotty anglease?  Nnn.  You phonio saxo?  Nnnn.
              Clear all so!  `Tis a Jute.... (Finnegans Wake 16.5)

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php




[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.