【发布时间】:2013-02-08 12:12:25
【问题描述】:
我正在过滤一个包含儿童鞋类型的大文件,男鞋和女鞋。
现在我想过滤掉某些类型的女鞋,以下 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')]
编辑:添加了请求的文件示例
<Products>
<!-- snip -->
<Product ProgramID="4875" ArticleNumber="GO1-f05-0001-12">
<CategoryPath>
<ProductCategoryID>34857489</ProductCategoryID>
<ProductCategoryPath>Damen > Sale > Schuhe > Sneaker > Sneaker Low</ProductCategoryPath>
<AffilinetProductCategoryPath>Kleidung & Accessoires?</AffilinetProductCategoryPath>
</CategoryPath>
<Price>
<DisplayPrice>40.95 EUR</DisplayPrice>
<Price>40.95</Price>
</Price>
</Product>
<!-- snip -->
</Products>
【问题讨论】:
-
能否添加一个简单的 XML 树示例?特别想看看
CategoryPath和ProductCategoryPath是怎么布局的。