小编Bra*_*ram的帖子

XPath包含多个值之一

我有简单的xpath

 /products/product[contains(categorie,'Kinderwagens')] 
Run Code Online (Sandbox Code Playgroud)

它有效,但现在如何过滤多个类别值

喜欢

/products/product[contains(categorie,'Kinderwagens')]  +  
/products/product[contains(categorie,'Kinderwagens')] 
Run Code Online (Sandbox Code Playgroud)

xpath filter

31
推荐指数
3
解决办法
5万
查看次数

XPath和/或语法,编写此Xpath的任何更短的方法

我正在过滤一个大文件,其中包含适合儿童,男人和女人的各种鞋子.

现在我想过滤掉某些类型的女鞋,下面的xpath有效,但是我正在使用的程序存在xpath长度限制.所以我想知道是否有更短/更有效的方法来构建这个xpath

/Products/Product[contains(CategoryPath/ProductCategoryPath,'Halbschuhe') and contains(CategoryPath/ProductCategoryPath,'Damen') or  contains(CategoryPath/ProductCategoryPath,'Sneaker') and contains(CategoryPath/ProductCategoryPath,'Damen') or contains(CategoryPath/ProductCategoryPath,'Ballerinas') and contains(CategoryPath/ProductCategoryPath,'Damen')]
Run Code Online (Sandbox Code Playgroud)

编辑:添加了请求的文件样本

<Products>
    <!-- snip -->
    <Product ProgramID="4875" ArticleNumber="GO1-f05-0001-12">
        <CategoryPath>
            <ProductCategoryID>34857489</ProductCategoryID>
            <ProductCategoryPath>Damen &gt; Sale &gt; Schuhe &gt; Sneaker &gt; Sneaker Low</ProductCategoryPath>
            <AffilinetProductCategoryPath>Kleidung &amp; Accessoires?</AffilinetProductCategoryPath>
        </CategoryPath>
        <Price>
            <DisplayPrice>40.95 EUR</DisplayPrice>
            <Price>40.95</Price>
        </Price>
    </Product>
    <!-- snip -->
</Products>
Run Code Online (Sandbox Code Playgroud)

xpath operators

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

xpath ×2

filter ×1

operators ×1