You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Maksims Zizkuns <ma...@exigengroup.lv> on 2007/03/01 11:27:24 UTC
XPath and Whitespaces
Hello,
Can somebody explain please: can really Node name contain whitespaces when
querying by XPath?
Here is what I can't understand:
JSR-170 states that:
1) Part 6.4.3 "Escaping of names": "for document view serialization,
each content repository
name is converted to a valid XML name (as defined by XML
1.0)
by translating invalid characters into escaped numeric
entity encodings5."
2) Part 6.6.1 "XPath over Document View" : "When an XPath query is
executed, the XPath expression specified is applied to the document view of
the workspace being searched."
3) Part 6.6.6.1/6.6.6.2 is an XPath grammar which states that
NameTest is a QName test but QName is referred as one defined on
http://www.w3.org/TR/REC-xml-names/#NT-QName
Now, from my point of view all said above means that non-escaped
whitespaces aren't allowed in a node name in XPath query.
However Jackrabbit TCK test
org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test
feels good executing XPath like: /jcr:root/testdata/custom sample nodes
/test:refTargetNode/jcr:deref(@jcr:versionHistory,
'h6bd9fd75-77db-470a-99d9-94a22f3c280a')
So, the question actually is who is right? TCK or JSR-170
or I missunderstood JSR-170 and there is no contradictions with TCK?
Thank you
Maks
Re: XPath and Whitespaces
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 3/1/07, Julian Reschke <ju...@gmx.de> wrote:
> Looks like a bug in
>
> private String createStatement(Property refProperty, String nameTest)
> throws RepositoryException {
> StringBuffer stmt = new StringBuffer();
>
> stmt.append("/").append(jcrRoot).append(refProperty.getParent().getPath());
> stmt.append("/").append(jcrDeref).append("(@");
> stmt.append(refProperty.getName()).append(", '");
> stmt.append(nameTest).append("')");
> return stmt.toString();
> }
>
> to me (it should do the required escaping of the name).
You're right. We actually encountered a similar problem earlier, see
JCR-714 for the related bug report.
BR,
Jukka Zitting
Re: XPath and Whitespaces
Posted by Julian Reschke <ju...@gmx.de>.
Maksims Zizkuns schrieb:
> ...
> Now, from my point of view all said above means that non-escaped
> whitespaces aren't allowed in a node name in XPath query.
>
> However Jackrabbit TCK test
> org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test
> feels good executing XPath like: /jcr:root/testdata/custom sample nodes
> /test:refTargetNode/jcr:deref(@jcr:versionHistory,
> 'h6bd9fd75-77db-470a-99d9-94a22f3c280a')
>
> So, the question actually is who is right? TCK or JSR-170
> or I missunderstood JSR-170 and there is no contradictions with TCK?
> ...
Looks like a bug in
private String createStatement(Property refProperty, String nameTest)
throws RepositoryException {
StringBuffer stmt = new StringBuffer();
stmt.append("/").append(jcrRoot).append(refProperty.getParent().getPath());
stmt.append("/").append(jcrDeref).append("(@");
stmt.append(refProperty.getName()).append(", '");
stmt.append(nameTest).append("')");
return stmt.toString();
}
to me (it should do the required escaping of the name).
Best regards, Julian