Search multiple words in xml

  • Hi all,
    i got xml file with 2600000 lines. In this file describes a number of products. Each of the products is described as follows:

    <PRODUCT mode=“new”>
    <KEYWORD lang=“pol”></KEYWORD>

    In line <SUPPLIER_PID> 285129 </ SUPPLIER_PID> is given No. of the product. I need an easy way to find hundreds of No. of the product in this file and remove all lines on this (all that is between the <PRODUCT mode = “new”> and </ PRODUCT>). In my xml file is not repeated No. of products so I want to do it automatically.

    Is there any way of doing this?

  • Not sure if I got this right: You are trying to remove PRODUCT Tags for a specific SUPPLIER_PID? If so try this:

    • Go to Search->Replace
    • Search for <PRODUCT mode="new">\R<SUPPLIER_PID>285129</SUPPLIER_PID>.*?</PRODUCT>
    • Replace with nothing
    • Select Regular Expressions. Make sure “. matches \r and \n” is checked
    • Hit “Replace all”

    But if you have to do this kind of job on a regular basis, you may want to look for a Tool that is more specifically made for manipulation of XML by XPath.

Log in to reply