RE: adding addressing capabilities to the DOM

I think that a programmatic way to bind values to variables in the XPath
expression would be extremely useful.

For instance consider:

	String s = "test with ' (single quote) and \" (double quote)";
	NodeList nl = node.getNodes ("xpath", "/foo/bar[@id='" + s + "']");

It is non-trivial to embed s into the XPath expression, because you can't
use single or double quotes to quote the string.

The best solution I have found so far is to construct the string expression
using XPath's concat() function if both types of quotes appear in the
string. I think it would be convenient to have an easier touse interface
where you can do something like

	NodeList nl = node.getNodes (xpath, "/foo/bar[@id=$var]",
variableAssignments);

(where variableAssigments would contain the mapping of variable names to
values). As XSLT processors are able to do this anyway, it should map nicely
into the processing model, right?

Julian


> -----Original Message-----
> From: owner-xml-dev@xml.org [mailto:owner-xml-dev@xml.org]On Behalf Of
> Aaron Skonnard
> Sent: Sunday, April 16, 2000 6:05 AM
> To: Paul Tchistopolskii; Xml-Dev@Xml. Org
> Subject: RE: adding addressing capabilities to the DOM
>
>
> If it's added to the Node interface, currentNode is implied.
>
> BTW, if anyone else has comments on this thread please copy www-dom@w3.org
> (not www-dom-request@w3.org, which was a mistake). TIA,
>
> -aaron
>
> > -----Original Message-----
> > From: Paul Tchistopolskii [mailto:paul@qub.com]
> > Sent: Saturday, April 15, 2000 8:42 PM
> > To: aaron@skonnard.com; Xml-Dev@Xml. Org
> > Cc: www-dom-request@w3.org
> > Subject: Re: adding addressing capabilities to the DOM
> >
> >
> >
> >  ----- Original Message -----
> > From: Aaron Skonnard
> > To: Xml-Dev@Xml. Org <xml-dev@xml.org>
> >
> > > NodeList getNodes(scheme, expression)
> >
> > Should be at least
> >
> > NodeList getNodes(scheme, expression, currentNode),
> >
> > I think.
> >
> > Rgds.Paul.
> >
> >
> >
>
>
> ******************************************************************
> *********
> This is xml-dev, the mailing list for XML developers.
> To unsubscribe, mailto:majordomo@xml.org&BODY=unsubscribe%20xml-dev
> List archives are available at http://xml.org/archives/xml-dev/
> ******************************************************************
> *********

Received on Sunday, 16 April 2000 11:28:28 UTC