Re: [xml] bug in xpath/xpointer ids processing?
- From: Daniel Veillard <veillard redhat com>
- To: Aleksey Sanin <aleksey aleksey com>
- Cc: xml gnome org, Lanre Amos <lanre molan com>
- Subject: Re: [xml] bug in xpath/xpointer ids processing?
- Date: Tue, 25 Mar 2003 05:05:38 -0500
On Mon, Mar 24, 2003 at 05:00:40PM -0800, Aleksey Sanin wrote:
Hi, Daniel!
One of xmlsec users reported a problem with "id()" xpath function
when id attribute contains a plus sign. For example,
[aleksey lsh gnome-xml]$ cat test.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE test [
<!ATTLIST Test id ID #IMPLIED>
]>
<Root>
<Test id="a+b">
Hello!
</Test>
</Root>
[aleksey lsh gnome-xml]$ ./testXPath --input test.xml "id('a+b')"
Object is a Node Set :
Set contains 0 nodes:
As far as I can understand "id()" function description (section 4.1 of
XPath 1.0 spec),
No, that's a violation of the XML spec:
http://www.w3.org/TR/REC-xml#sec-attribute-types
"Values of type ID must match the Name production."
[5] Name ::= (Letter | '_' | ':') (NameChar)*
The ID name is not correct. This is not reported because apparently
the document isn't validated, but since it's not a Name, this can't be used
as an ID and xpath code is perfectly right in checking and preventing its
use as an id.
The libxml2 code should not be changed in this case. And you should
report the error to your user before he think he can deploy instance of
documents with + in ID names.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]