XQuery , selecting "<" problem

i have this html tree

<td align="center">
<a class="iframe2" href="/global/products/specs/?driveID=868&language=1">WD20EURS</a></td>
<td align="center">SATA 3 Gb/s</td>
<td align="center">3.5 Inch</td>
<td align="center"><span style="display:none;">240</span>2 TB</td>
<td align="center">< 1</td>
<td align="center">240</td>

i have this query


The problem is that it is that the node “td” containing the value “<1” is selected but the value is not outputed - the result is empty str. - " ".
I’ve tried like this , but it is still not working.
should i register a namespace for that element to be able to receive the value
in it.


I just don’t know what else to try .
How do i select the node containing “<1” ?

My guess is it’s seeing this
<td align=“center”><
as indicating an empty node.

Maybe escape like \< in the path??

Though IMHO the best chance for success would be to use an entity like
<td align=“center”><



does not work.
unfortunatelly i can’t edit the original HTML document
Isn’t there any way to select this from Xpath ?

i didn’t find the edit button , so i am posting a new one , may i be excused.
I’ve made some testing and it turns out that the problem is in the “loadHTML()” function.
It doesn’t read the value in the tag - “<td>< 1</td>” i.e. “< 1” , but i have it the HTML file.
The problem is not in XPath .
How to load that value into the php script ?

The [COLOR="DarkRed"]<td align="center">< 1</td>[/COLOR] is broken HTML as far as PHP is concerned.

When PHP loads the HTML, it does its best to figure out what was intended and interprets the HTML as [COLOR="DarkRed"]<td align="center"></td>[/COLOR]. Note the missing [COLOR="DarkRed"]< 1[/COLOR], which explains why you got an empty string!

It looks like you’re using Zend_Query for this (are you?) which does not help much since it is hard-coded to silence any warnings generated when PHP spots problems with the HTML.

i was going with zend_dom_query ,but then switched back to php.
Now that you’ve mention it php does trow a warning.

Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: htmlParseStartTag: invalid element name in Entity, line: 158 in C:\\xampp\\htdocs\\xXxXx\\application\\controllers\\IndexController.php on line 66

I am pretty convinced now , that i should escape the “<” character.