HTML, XPath and the id() function

View: New views
3 Messages — Rating Filter:   Alert me  

HTML, XPath and the id() function

by Aaron Patterson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm seeing a strange behavior when using the id() xpath function with
HTML documents.  If the HTML document contains a DOCTYPE, the id()
function works as expected.  If the HTML document does not contain a
DOCTYPE, the id() function does not work (even with document
correction enabled).  Is this a bug, or am I missing something?

I've written a short example to illustrate the problem here (I'm using
libxml2 2.7.5):

    http://gist.github.com/209686

Thanks for the help!

--
Aaron Patterson
http://tenderlovemaking.com/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@...
http://mail.gnome.org/mailman/listinfo/xml

Re: HTML, XPath and the id() function

by Daniel Veillard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Oct 13, 2009 at 05:13:28PM -0700, Aaron Patterson wrote:

> I'm seeing a strange behavior when using the id() xpath function with
> HTML documents.  If the HTML document contains a DOCTYPE, the id()
> function works as expected.  If the HTML document does not contain a
> DOCTYPE, the id() function does not work (even with document
> correction enabled).  Is this a bug, or am I missing something?
>
> I've written a short example to illustrate the problem here (I'm using
> libxml2 2.7.5):
>
>     http://gist.github.com/209686

  Hum, good point, I just commited a fix for this in git head, a
1 line fix in xmlIsID()

  thanks for the report !

Daniel

--
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@...  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@...
http://mail.gnome.org/mailman/listinfo/xml

Re: HTML, XPath and the id() function

by Aaron Patterson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Oct 16, 2009 at 7:50 AM, Daniel Veillard <veillard@...> wrote:

> On Tue, Oct 13, 2009 at 05:13:28PM -0700, Aaron Patterson wrote:
>> I'm seeing a strange behavior when using the id() xpath function with
>> HTML documents.  If the HTML document contains a DOCTYPE, the id()
>> function works as expected.  If the HTML document does not contain a
>> DOCTYPE, the id() function does not work (even with document
>> correction enabled).  Is this a bug, or am I missing something?
>>
>> I've written a short example to illustrate the problem here (I'm using
>> libxml2 2.7.5):
>>
>>     http://gist.github.com/209686
>
>  Hum, good point, I just commited a fix for this in git head, a
> 1 line fix in xmlIsID()
>
>  thanks for the report !

Thank you for the fix!

--
Aaron Patterson
http://tenderlovemaking.com/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml@...
http://mail.gnome.org/mailman/listinfo/xml