LANGREITER.COM plain, simple
      START     INDEX
 
helma-selectVisualize Context (requires Java Plug-in)
CREATED BY chris • LAST EDITED BY chris 5286 days AGO
helma-select

helma-select is a prototypical JavaScript implementation of XPath object graph navigation for Helma. It works by providing a Jaxen Navigator (object graph adaptor).

Examples of Use

<HopObject>.select(xpathExpr[, hierarchyMode])

var children = root.select("*");
var josefsPages = root.select("company/team/*[creator/@name='josef']");
var friendsOfFriends = chris.select("friends/*/friends/*");
var wahreFreunde = chris.select("friends/*[@rating > 5]");
var allTexts = root.select("//@text", true); // note the hierarchyMode!

Caveats

As there's no 1:1 object graph/XML Infoset mapping, a few tradeoffs concerning graph expansion had to be made: In "hierarchy mode", the navigator follows only the hierarchy defined by _parent relationships (plus one expansion at the leaves), in "graph mode" all child nodes are always expanded, which can result in infinite loops when using recursive queries like //<element>. It is thought that this is one of the more practical approaches to solve that problem.

helma-select in its current incarnation is probably not exactly fast. If usefulness warrants the effort, a native Java version should replace this implementation.

The primary purpose of this version is to gather experience as for what effects more advanced object graph navigation and querying facilities might have on application design and code size. Besides, it also demonstrates some of the new JavaScript constructs available thanks to the recently integrated Rhino engine (syntactical support for first-class functions, JavaAdapter).

So far I've only tested helma-select with a fairly simple application and an accordingly simple object graph. It seems to work nicely.

Prerequisites

Helma 1.3.0 alpha + (Rhino).
Jaxen: Put jaxen-core.jar and saxpath.jar in lib/ext.

Installation

Put the files into the hopobject directory of an application.

Download

www.langreiter.com/helma/helma-select/

Comments &c.

To me, please.


  SEARCH

GET YOUR MOVE ON

  ALMOST ALL ABOUT YOU
So log in, fella — or finally get your langreiter.com account. You always wanted one.
Nearby in the temporal dimension:
Nobody.
... and 19 of the anonymous kind.
Click on Join us in the chatterbox dimension! for a moderate dose of lcom-talk. This will probably not work in Lynx and other browser exotica.


BACKLINKS
  2003-06-28-select

RECENT EDITS (MORE)
  films-seen
  Blood Stone
  y!kes
  wet towel
  B Studio
  Pilcrow News
  Nastassja Kinski
  2011-10-06-steve
  2011-10-06
  comment-2011-08-04-1

POWERED BY
Special Entanglement Forces provided by Vanilla

&c.
GeoURL RSS 0.92

FRIENDLY SHOPS
Uncut Games bei Gameware

OFFEN!
Offenlegung gem. 25 MedienG:
Christian Langreiter, Langkampfen
See also: Privacy policy.



 
EDIT