You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Jan Kuźniak <ja...@cognifide.com> on 2006/12/01 12:52:35 UTC
Node name starting with number problem
Hello,
I have just encountered new problem: When I start node name with number,
I get exception from XPathQueryBuilder when performing XPathQuery. Is it
a bug, or just my assumption that this should work is wrong? Should I
create a JIRA issue?
I attach test that reproduces this error.
--
Regards,
Jan
Re: Node name starting with number problem
Posted by Jan Kuźniak <ja...@cognifide.com>.
Jukka Zitting napisał(a):
> Hi,
>
> On 12/1/06, Jan Kuźniak <ja...@cognifide.com> wrote:
>> I have just encountered new problem: When I start node name with number,
>> I get exception from XPathQueryBuilder when performing XPathQuery. Is it
>> a bug, or just my assumption that this should work is wrong? Should I
>> create a JIRA issue?
>
> It's a feature, not a bug. JCR names are a superset of XML names, and
> thus you can have a node name starting with a number even though it
> wouldn't be a valid XML element name. Since XPath is based on XML, it
> also considers such names invalid. To work around that issue the JCR
> spec notes that the XPath queries are interpreted as if they were
> executed against the document view XML mapping of the repository.
> Thus, you need to use the _xNNNN_ encoding format for any JCR names
> that are not valid XML names.
>
> BR,
>
> Jukka Zitting
Thanks a lot, that explains it. However it seems to be a little
inconsistency. Maybe it would be nice to implement this translation in
jackrabbit itself?
--
Regards,
Jan
Re: Node name starting with number problem
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 12/1/06, Jan Kuźniak <ja...@cognifide.com> wrote:
> I have just encountered new problem: When I start node name with number,
> I get exception from XPathQueryBuilder when performing XPathQuery. Is it
> a bug, or just my assumption that this should work is wrong? Should I
> create a JIRA issue?
It's a feature, not a bug. JCR names are a superset of XML names, and
thus you can have a node name starting with a number even though it
wouldn't be a valid XML element name. Since XPath is based on XML, it
also considers such names invalid. To work around that issue the JCR
spec notes that the XPath queries are interpreted as if they were
executed against the document view XML mapping of the repository.
Thus, you need to use the _xNNNN_ encoding format for any JCR names
that are not valid XML names.
BR,
Jukka Zitting