Paul Hammant wrote:
> 
> Peter Donald wrote:
> 
> >I was thinking about something as simple as current setup.
> >
> >ie
> >
> >vois storeConfiguration( String application,
> >                         String block,
> >                         Configuration config );
> >
> Hmm, that forced the comp writer to have some way of constructing an
> tree of Configuration objects themselves.  I'd guess getting it right is
> a high art and buckets of code.  Though there are good points raised
> about reliance on Xpath and it's implicit underlying XML document, I
> think it's a simple think for component writers to use.

There are issues beyond that as well.  XPath is in no way simple.  It's
actually a potentially very complex and highly flexible language that
maps well to XML documents, but not necessary well to non-XML
structures.  It's definitely not easy to write an XPath implementation
(as the Xalan people).  Beyond that, there are other issues, like the
nature of selectors, for example:

//node()

Is a perfectly valid XPath selector that recursively selects *every*
node in a tree.  This includes elements, attributes, text, cdata,
comments, etc....  If you were to use this XPath as a selector for
performing a modification to a tree, you'd end up touching the entire
tree, which could be very bad.  There are also the functions that return
non-nodesets, and may modify the values of the returned values in the
process.

I would propose a terse, simplified pathing system that does not support
functions, all-descendent/ancestor axis, and many of the other nice
features of XPath that neither translate well to a configuration model,
or translate well to a non-XML structure.

Another possibility, is to just stick with method calls (ex):

cfg.getChild("somechild").getChild("anotherchild").getValueAsLong();

For two reasons:
1 - Though verbose, it provides the same functionality a terse pathing
form would.
2 - It's structural validity can be qualified at compile-time.. XPath
would require run-time validation.

-- 
Tom Bradford  The dbXML Group, L.L.C.  http://www.dbxmlgroup.com/
Desktop, Laptop, Settop, Palmtop.  Can your XML database do that?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to