在单个xpath中选择多个节点

时间:2015-09-09 10:35:57

标签: php html xpath

如何从此html元素中选择所有<tr>,然后

  1. 从第一个td
  2. 中选择/ small / a
  3. 从第二个td
  4. 中选择/ small / i
  5. 从第三个td
  6. 中选择/小
  7. 从第四个td
  8. 中选择/小
  9. 从第六个td
  10. 中选择/表格

    我想在php中使用从这里获得的信息作为数组或对象

    提前致谢

    <tbody><tr>
        <td colspan="6" class="title">Applications</td>
    </tr>
    <tr>
        <td class="header-left"><small>Path</small></td>
        <td class="header-left"><small>Version</small></td>
        <td class="header-center"><small>Display Name</small></td>
        <td class="header-center"><small>Running</small></td>
        <td class="header-left"><small>Sessions</small></td>
        <td class="header-left"><small>Commands</small></td>
    </tr>
    <tr>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small><a href="/">/</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small><i>None specified</i></small></td>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small>Welcome to Tomcat</small></td>
        <td class="row-center" rowspan="2" bgcolor="#FFFFFF"><small>true</small></td>
        <td class="row-center" rowspan="2" bgcolor="#FFFFFF"><small><a href="/manager/html/sessions?path=/&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">0</a></small></td>
        <td class="row-left" bgcolor="#FFFFFF">
            &nbsp;<small>Start</small>&nbsp;
            <form class="inline" method="POST" action="/manager/html/stop?path=/&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">  <small><input value="Stop" type="submit"></small>  </form>
            <form class="inline" method="POST" action="/manager/html/reload?path=/&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">  <small><input value="Reload" type="submit"></small>  </form>
            <form class="inline" method="POST" action="/manager/html/undeploy?path=/&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">  <small><input value="Undeploy" type="submit"></small>  </form>
        </td>
    </tr><tr>
        <td class="row-left" bgcolor="#FFFFFF">
            <form method="POST" action="/manager/html/expire?path=/&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">
                <small>
                    &nbsp;<input value="Expire sessions" type="submit">&nbsp;with idle ≥&nbsp;<input name="idle" size="5" value="30" type="text">&nbsp;minutes&nbsp;
                </small>
            </form>
        </td>
    </tr>
    <tr>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small><a href="/item1/">/item1</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small><i>None specified</i></small></td>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small>&nbsp;</small></td>
        <td class="row-center" rowspan="2" bgcolor="#C3F3C3"><small>false</small></td>
        <td class="row-center" rowspan="2" bgcolor="#C3F3C3"><small><a href="/manager/html/sessions">0</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3">
            <form class="inline" method="POST" action="item1Start">
                <small>
                    <input value="Start" type="submit">
                </small>
            </form>
            &nbsp;<small>Stop</small>&nbsp;
            &nbsp;<small>Reload</small>&nbsp;
            <form class="inline" method="POST" action="item1Undeploy">
                <small>
                    <input value="Undeploy" type="submit">
                </small>
            </form>
        </td>
    </tr>
    <tr></tr>
    <tr>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small><a href="/item2/">/item2</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small><i>None specified</i></small></td>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF"><small>&nbsp;</small></td>
        <td class="row-center" rowspan="2" bgcolor="#FFFFFF"><small>false</small></td>
        <td class="row-center" rowspan="2" bgcolor="#FFFFFF"><small><a href="/manager/html/sessions">0</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#FFFFFF">
            <form class="inline" method="POST" action="/manager/html/sessions?path=/manager">  <small><input value="Start" type="submit"></small>  </form>
            &nbsp;<small>Stop</small>&nbsp;
            &nbsp;<small>Reload</small>&nbsp;
            <form class="inline" method="POST" action="/manager/html/sessions?path=/manager">
                <small>
                    <input value="Undeploy" type="submit">
                </small>
            </form>
        </td>
    </tr>
    <tr></tr>
    <tr>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small><a href="/manager/">/manager</a></small></td>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small><i>None specified</i></small></td>
        <td class="row-left" rowspan="2" bgcolor="#C3F3C3"><small>Tomcat Manager Application</small></td>
        <td class="row-center" rowspan="2" bgcolor="#C3F3C3"><small>true</small></td>
        <td class="row-center" rowspan="2" bgcolor="#C3F3C3"><small><a href="/manager/html/sessions?path=/manager&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">33</a></small></td>
        <td class="row-left" bgcolor="#C3F3C3">
            <small>
                &nbsp;Start&nbsp;
                &nbsp;Stop&nbsp;
                &nbsp;Reload&nbsp;
                &nbsp;Undeploy&nbsp;
            </small>
        </td>
    </tr><tr>
        <td class="row-left" bgcolor="#C3F3C3">
            <form method="POST" action="/manager/html/expire?path=/manager&amp;org.apache.catalina.filters.CSRF_NONCE=7DF475B8EF3807C4BCA8651FEBA676EA">
                <small>
                    &nbsp;<input value="Expire sessions" type="submit">&nbsp;with idle ≥&nbsp;<input name="idle" size="5" value="30" type="text">&nbsp;minutes&nbsp;
                </small>
            </form>
        </td>
    </tr>
    </tbody>

0 个答案:

没有答案