You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torgeir Veimo <to...@pobox.com> on 2009/01/20 22:39:20 UTC
using nodes with names starting with numbers
I seem to be able to successfully create nodes with names starting
with a number, but I cannot search for them with the query string eg.
/jcr:root/nen:content/people/5cb31fb82acd41b29fceaa7536cc74a6/
nen:wall//element(*,nen:message)
when I've successfully created a node with name /jcr:root/nen:content/
people/5cb31fb82acd41b29fceaa7536cc74a6/
I had a quick glance in the 170 spec, and I couldn't find any
indication that a node cannot start with a number, at least not in
section 4.6 Path Syntax.
Should I escape the name when creating the node, so that it doesn't
start with a name, or should I escape the search, or is there a bug in
the query parser?
--
Torgeir Veimo
torgeir@pobox.com
Re: using nodes with names starting with numbers
Posted by Torgeir Veimo <to...@pobox.com>.
On 21 Jan 2009, at 08:48, Alexander Klimetschek wrote:
> JCR node names can start with numbers, but leading digits in XPath
> queries need to be escaped. You can use the
> org.apache.jackrabbit.util.ISO9075 helper class from
> jackrabbit-jcr-commons [1] for that, which Vijay already mentioned.
>
> [1] http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/util/ISO9075.html
Ok, that works, thanks!
--
Torgeir Veimo
torgeir@pobox.com
Re: using nodes with names starting with numbers
Posted by Alexander Klimetschek <ak...@day.com>.
On Tue, Jan 20, 2009 at 10:39 PM, Torgeir Veimo <to...@pobox.com> wrote:
> I seem to be able to successfully create nodes with names starting with a
> number, but I cannot search for them with the query string eg.
>
> /jcr:root/nen:content/people/5cb31fb82acd41b29fceaa7536cc74a6/nen:wall//element(*,nen:message)
>
> when I've successfully created a node with name
> /jcr:root/nen:content/people/5cb31fb82acd41b29fceaa7536cc74a6/
>
> I had a quick glance in the 170 spec, and I couldn't find any indication
> that a node cannot start with a number, at least not in section 4.6 Path
> Syntax.
>
> Should I escape the name when creating the node, so that it doesn't start
> with a name, or should I escape the search, or is there a bug in the query
> parser?
JCR node names can start with numbers, but leading digits in XPath
queries need to be escaped. You can use the
org.apache.jackrabbit.util.ISO9075 helper class from
jackrabbit-jcr-commons [1] for that, which Vijay already mentioned.
[1] http://jackrabbit.apache.org/api/1.5/org/apache/jackrabbit/util/ISO9075.html
Regards,
Alex
--
Alexander Klimetschek
alexander.klimetschek@day.com
RE: using nodes with names starting with numbers
Posted by Vijay Pandey <VP...@mdes.ms.gov>.
If the first character is a digit, you can use this class
org.apache.jackrabbit.util.ISO9075 to encode.
Thanks
Vijay
-----Original Message-----
From: Torgeir Veimo [mailto:torgeir@pobox.com]
Sent: Tuesday, January 20, 2009 3:39 PM
To: users@jackrabbit.apache.org
Subject: using nodes with names starting with numbers
I seem to be able to successfully create nodes with names starting
with a number, but I cannot search for them with the query string eg.
/jcr:root/nen:content/people/5cb31fb82acd41b29fceaa7536cc74a6/
nen:wall//element(*,nen:message)
when I've successfully created a node with name /jcr:root/nen:content/
people/5cb31fb82acd41b29fceaa7536cc74a6/
I had a quick glance in the 170 spec, and I couldn't find any
indication that a node cannot start with a number, at least not in
section 4.6 Path Syntax.
Should I escape the name when creating the node, so that it doesn't
start with a name, or should I escape the search, or is there a bug in
the query parser?
--
Torgeir Veimo
torgeir@pobox.com