You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Jeff Lansing <je...@polexis.com> on 2003/08/07 22:17:37 UTC

[JXPATH] @name feature

Hi,

The @name feature for accessing Map entries has a problem. This works 
fine for the simple names used in the example, such as 
getValue("addresses[@name='home']/zipCode"), and there is even a note 
that says: "Note: At this point JXPath only supports Maps that use 
strings for keys."

The problem is that a HashMap key can be any String, including one that 
contains the character ':'. But the @name feature tries to turn this 
string into the local part of a QName, and if there is a ':', the QName 
constructor throws an exception.

So this feature doesn't work when keys are URL's, which is actually a 
very common thing to do.

Thanks,

Jeff



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [JXPATH] @name feature

Posted by Dmitri Plotnikov <dm...@apache.org>.
Jeff,

I solved the problem by removing the validation from the QName constructor.
It was superfluous anyway, as the XPath compiler performs the necessary
lexical checks prior to instantiation of a QName.

Thanks for reporting this issue.

- Dmitri


----- Original Message ----- 
From: "Jeff Lansing" <je...@polexis.com>
To: <co...@jakarta.apache.org>
Sent: Thursday, August 07, 2003 4:17 PM
Subject: [JXPATH] @name feature


> Hi,
>
> The @name feature for accessing Map entries has a problem. This works
> fine for the simple names used in the example, such as
> getValue("addresses[@name='home']/zipCode"), and there is even a note
> that says: "Note: At this point JXPath only supports Maps that use
> strings for keys."
>
> The problem is that a HashMap key can be any String, including one that
> contains the character ':'. But the @name feature tries to turn this
> string into the local part of a QName, and if there is a ':', the QName
> constructor throws an exception.
>
> So this feature doesn't work when keys are URL's, which is actually a
> very common thing to do.
>
> Thanks,
>
> Jeff
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>


Re: [JXPATH] @name feature

Posted by Dmitri Plotnikov <dp...@yahoo.com>.
Interesting.  I'll try to look into this, but I cannot promise a very
quick fix: I am currently swamped both at my day job and at home.

Thanks for reporting this.

- Dmitri

--- Jeff Lansing <je...@polexis.com> wrote:
> Hi,
> 
> The @name feature for accessing Map entries has a problem. This works
> 
> fine for the simple names used in the example, such as 
> getValue("addresses[@name='home']/zipCode"), and there is even a note
> 
> that says: "Note: At this point JXPath only supports Maps that use 
> strings for keys."
> 
> The problem is that a HashMap key can be any String, including one
> that 
> contains the character ':'. But the @name feature tries to turn this 
> string into the local part of a QName, and if there is a ':', the
> QName 
> constructor throws an exception.
> 
> So this feature doesn't work when keys are URL's, which is actually a
> 
> very common thing to do.
> 
> Thanks,
> 
> Jeff
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Re: [JXPATH] @name feature

Posted by Dmitri Plotnikov <dp...@yahoo.com>.
Interesting.  I'll try to look into this, but I cannot promise a very
quick fix: I am currently swamped both at my day job and at home.

Thanks for reporting this.

- Dmitri

--- Jeff Lansing <je...@polexis.com> wrote:
> Hi,
> 
> The @name feature for accessing Map entries has a problem. This works
> 
> fine for the simple names used in the example, such as 
> getValue("addresses[@name='home']/zipCode"), and there is even a note
> 
> that says: "Note: At this point JXPath only supports Maps that use 
> strings for keys."
> 
> The problem is that a HashMap key can be any String, including one
> that 
> contains the character ':'. But the @name feature tries to turn this 
> string into the local part of a QName, and if there is a ':', the
> QName 
> constructor throws an exception.
> 
> So this feature doesn't work when keys are URL's, which is actually a
> 
> very common thing to do.
> 
> Thanks,
> 
> Jeff
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org