duanshan3065 2011-02-27 10:57
浏览 177
已采纳

使用SimpleXML获取“Form”元素,其中“input”标签的类型为“password”?

Hi I have webpage data (html converted into xml) consisting of many forms , I want to grab the form which have input tag inside it of type password ( not necessary direct children) . consider example below data stored inside variable $html

<html>
<body>

<form>
<input type="text" name="foo" />
</form>

<form>
<table>
<tr> <input type="password" name="pass"/> </tr>
</table>
</form>

</body>
</html>

I tried

$loginForm  =  $html->xpath('//form//input[@type="password"]//../form'); 

But didnt succeeded :(

Thanks.

  • 写回答

2条回答 默认 最新

  • druzuz321103 2011-02-27 11:30
    关注

    Try this XPath:

    //form[descendant::input[@type="password"]]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录