首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从Xidel输出中排除类

如何从Xidel输出中排除类
EN

Stack Overflow用户
提问于 2016-04-28 20:59:13
回答 1查看 354关注 0票数 0

我希望通过删除包含“”的行来使用xpath://BODY/DIV来细化我的Xidel输出,并且只保留"MyClass“行。

我可以在Xidel输出文件中添加中断行吗?

代码语言:javascript
复制
<a class="AClass" href="http://www.mywebsite.com/file1" target="_blank"> File1 </a>    
<a class="AClass" href="http://www.mywebsite.com/file2" target="_blank"> File2 </a>    
<a class="AClass" href="http://www.mywebsite.com/file3" target="_blank"> File3 </a>
<a class="AClass" href="http://www.mywebsite.com/file4" target="_blank"> File4 </a>
<a class="MyClass" href="http://www.mywebsite.com/file5" target="_blank"> File5 </a>
<a class="AClass" href="http://www.mywebsite.com/file6" target="_blank"> File6 </a>
<a class="MyClass" href="http://www.mywebsite.com/file7" target="_blank"> File7 </a>
EN

回答 1

Stack Overflow用户

发布于 2016-12-02 00:02:07

要用XQuery排除一个属性,我们可以使用正则不等式,在您的示例中,它将是//a[@class !="AClass"]

这与包含属性类<a>的所有不等于AClass的属性类AClass匹配,无论深度如何。

至于您的另一个问题,关于在xidel的输出文件中添加换行符,可以使用--output-footer--output-separator标志,这取决于您的意思。

--output-footer将字符串附加到所有输出的末尾(例如,多行中断)。

--output-separator在每个项的末尾追加一个字符串。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36925357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档