jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Problem with ISO9075 encoded name in XPath Query?
Date Wed, 04 Mar 2009 17:05:54 GMT
2009/3/2 Mario-Leander Reimer <leander.reimer@vva-networks.de>:
> I have a problem with an XPath query in our system when the path contains spaces. Well,
it does not really contain spaces. When we save the node, we encode the name and path with
the ISO9075 class (org.apache.jackrabbit.util.ISO9075)

There are *two different* encodings that apply here:

a) Valid JCR node names: this is separately specified in the JCR spec
(section 6.2.5.2 [1]), and basically follows URI encoding; but it also
allows spaces, for example! For proper encoding/decoding (using the
%NN URI-style escaping) use the
org.apache.jackrabbit.util.Text.escapeIllegalJcrChars() and
unescapeIllegalJcrChars() methods.

b) XPath queries and XML document view: since XPath is tied to XML, it
requires valid XML names (section 6.6.6.1 [2]), same goes for the XML
document view export (section 6.4.3 [3] or footnote 5 in the spec).
This is the ISO 9075 encoding (copied from SQL-over-XML mapping) and
is different from a) (for example, leading digits are not allowed).
For this, you can use the ISO9075 class you mentioned. You will only
have to use it to encode the path elements of the XPath query.


[1] http://www.day.com/specs/jcr/1.0/6.2.5.2_Name.html
[2] http://www.day.com/specs/jcr/1.0/6.6.6.1_Named_Terminals.html
[3] http://www.day.com/specs/jcr/1.0/6.4.3_Escaping_of_Names.html

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message