我希望通过删除包含“”的行来使用xpath://BODY/DIV来细化我的Xidel输出,并且只保留"MyClass“行。
我可以在Xidel输出文件中添加中断行吗?
<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>发布于 2016-12-02 00:02:07
要用XQuery排除一个属性,我们可以使用正则不等式,在您的示例中,它将是//a[@class !="AClass"]。
这与包含属性类<a>的所有不等于AClass的属性类AClass匹配,无论深度如何。
至于您的另一个问题,关于在xidel的输出文件中添加换行符,可以使用--output-footer或--output-separator标志,这取决于您的意思。
--output-footer将字符串附加到所有输出的末尾(例如,多行中断)。
--output-separator在每个项的末尾追加一个字符串。
https://stackoverflow.com/questions/36925357
复制相似问题