[ 
https://issues.apache.org/jira/browse/JXPATH-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369398#comment-16369398
 ] 

Sandro Mario Zbinden commented on JXPATH-18:
--------------------------------------------

Is there a way arround this.

 

This is a requirement when accessing a key inside a hashmap where the key is 
numeric.

 

Example:

 
{code:java}
// code placeholder
Map<String, Object> patients = ImmutableMap.of("1", patient1, "2", patient2);
ImmutableMap<String, Map<String, Object>> patientMap = 
ImmutableMap.of("patients", patients);
JXPathContext context = JXPathContext.newContext(patientMap);
Object value = context.getValue("patients/1");
{code}
 

 

 

> createPathAndSetValue fails
> ---------------------------
>
>                 Key: JXPATH-18
>                 URL: https://issues.apache.org/jira/browse/JXPATH-18
>             Project: Commons JXPath
>          Issue Type: Bug
>    Affects Versions: 1.1 Final
>         Environment: Operating System: other
> Platform: All
>            Reporter: Thomas Mathis
>            Priority: Major
>
> jXPathContext.createPathAndSetValue("/element1/element2/1_numberelement","val"));
> fails with the following error:
> org.apache.commons.jxpath.JXPathException: Invalid XPath:
> '/element1/element2/1_numberelement'. Syntax error after: 
> '/element1/element2/'
>       at org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:106)
>       at
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpression(JXPathContextReferenceImpl.java:248)
>       at
> org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.createPathAndSetValue(JXPathContextReferenceImpl.java:421)
> This does not happen when I rename the path to 
> "/element1/element2/numberelement_1".
> Gtx,
> Thomas



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to