How to exclude by xpath certain keyword and ID

Marian

I have xml file, where I have many products. Not all of them I would like to use for import. By using XPATH I need to exclude from import every item, which contains specific name: lens

<items>
<item>

 <id>12612991</id>
 <name>Polarized Lens</name>
 <description></description>
 <video>link</video>
 <status>expired</status>
 <price>0</price>
 <currency></currency>

</item>

<item>

 <id>12612921</id>
 <name>Polarized glass</name>
 <description>asdf</description>
 <video>link</video>
 <status>expired</status>
 <price>0</price>
 <currency></currency>

</item>
</items>

I am trying to use this:

//*[not(contains(name(),'Lens'))]

So only one item from two will be imported, in this case -> Polarized glass

Also I am trying to exclude from import any items with specific ID`s

//*[not(contains(ID(),'12612921,12612926,12612924'))]

Thanks for your help.

Andersson

try below XPath to get required output:

//item[not(contains(name/text(), 'Lens')) and not(id=('12612921', '12612926', '12612924'))]

If you use XPath 1.0:

//item[not(contains(name/text(), 'Lens')) and not(id='12612921') and not(id='12612926') and not(id='12612924')]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to exclude certain domains from an npm proxy

bootstrap how to exclude style on certain element

How to exclude certain vertices in gremlin titan

How to exclude (ignore) certain folders in vagrant rsync?

xpath to href that contains certain keyword in link itself

How to exclude certain columns of a pandas dataframe?

Xpath - how to exclude nodes that contain attribute?

How to exclude certain terms for renaming in Android Studio

How do exclude elements from an Xpath query?

How to exclude certain variables from recipe?

How to exclude certain possibilities from a regular expression?

How to exclude certain words in sentence. regex?

Xpath set operations - exclude certain nodes (for example with certain feature or features)

Using xpath to exclude inner classes that contains any of 2 certain words

how to exclude certain columns being returned in hibernate

How do I exclude certain variable parts?

How to exclude a certain word in a regular expression in JMeter?

How to exclude certain parameters in dynamic urls?

Exclude certain keyword from URL

Sed help - how to exclude certain pattern

How to exclude certain variables from POJO for logging

exclude certain element in xPath c#

How can I exclude certain salaries and then order by?

How to get last 9 records but exclude the record with a certain ID using Eloquent?

How to exclude certain string values via regex?

exclude certain text from keyword analysis in google sheets

Bash find files with certain extension, but exclude those with certain keyword in filename

How to exclude loss computation on certain tensors in PyTorch?

How take id from .exclude(id=id)