php – XPath Query Problems

Question:

HTML:

<div align="center"><center>

<table border="0" cellpadding="0">
  <tr>
    <td bgcolor="#006090" valign="top" align="center"><p align="center"><strong><font face="Tahoma"
    size="2" color="#FFFFFF">Selecione a Semana</font></strong></td>
  </tr>
  <tr>
    <td valign="top" align="center" height="1" bgcolor="#22A7D2"><form method="POST">
      <dl>
        <div align="center">
        <dt><font size="2" face="Tahoma">&nbsp;<font color="#FFFFFF"><input type="text" name="EDR" size="20"
          style="background-color: rgb(34,167,210); color: rgb(34,167,210); border: medium none"
          value="Tudo"></font></font></dt>
        </div>
        <dd>&nbsp;</dd>
        <div align="center">
        <dt><strong><font size="2" face="Tahoma">Semana:</font> </strong></dt>
        </div><div align="center">
        <dt><font size="2" face="Tahoma"></font></dt>
        </div>
        <dt><font size="2" face="Tahoma"><strong>&nbsp;&nbsp;&nbsp;&nbsp; </strong><font color="#FFFFFF"><select name="Inicio"
          size="1" style="background-color: rgb(255,255,255); color: rgb(0,0,128)">
            <option value="16/2/2015">16/2/2015 - 22/2/2015 </option>
            <option value="9/2/2015">9/2/2015 - 15/2/2015 </option>

NOTE: The html continues with many more options, but so far you can have an idea. The query I'm trying to use to get the value of the options (ALL):

//select[name='Inicio']/option/@value

NOTE: I couldn't test the query to see if it worked. When I try to echo in php:

echo $nodes->item(0)->nodeValue;

Error returned:

Notice: Trying to get property of non-object in C:\xampp\

I imagine I'm making a mistake in the query , I'm not sure if I need to go through the whole html with the query to get to the options or I can go straight to the select as I did . Does anyone know where the error is?

Answer:

Almost: missing an @ no name ; then the query, which is like this:

//select[name="Inicio"]/option/@value

It should look like this:

//select[@name="Inicio"]/option/@value
Scroll to Top