php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50390 DomXPath fails to find data
Submitted: 2009-12-05 10:42 UTC Modified: 2009-12-05 15:59 UTC
From: liviu dot macoviciuc at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.11 OS: windows xp
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: liviu dot macoviciuc at gmail dot com
New email:
PHP Version: OS:

 

 [2009-12-05 10:42 UTC] liviu dot macoviciuc at gmail dot com
Description:
------------
I have an html file and I try to locate an element with Xpath.
Results : 0
I rewrote it in C with libxml2 
Results :1
CORRECT
So the problem is in php
I can provide the source code for all files
It is not my first bad experience with xpath in php
Another time, it used to return the right results, but 10 times


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-05 10:49 UTC] rrichards@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-12-05 10:59 UTC] liviu dot macoviciuc at gmail dot com
http://www.storage.to/get/lgBv4d7m/Desktop.rar

All the code
 [2009-12-05 12:10 UTC] rrichards@php.net
Works fine if you fix your script. You arent even providing valid data 
to load into a DOM.
 [2009-12-05 13:03 UTC] liviu dot macoviciuc at gmail dot com
Would you be so kind to tell me what am I doing wrong and how should I fix my script ?
Please !
 [2009-12-05 15:59 UTC] liviu dot macoviciuc at gmail dot com
OK
tHANKS
My bad
However, let me explain
The original file has an unappropiate /> at the end of the a tag
-http://www.chd.lu/wps/portal/public/FicheDepute?ref=22652-
(check for yourself)
After that ,there is an appropiate </a> tag
That is why I just coludn't get the corret result (even in libxml2)
Is this ok, given the fact that I have specified the flags 
HTML_PARSE_RECOVER|HTML_PARSE_NOERROR|HTML_PARSE_NOWARNING ?

Regards
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC