Community
    • Login

    Search multiple words in xml

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.9k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Łukasz RomanowskiŁ Offline
      Łukasz Romanowski
      last edited by

      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”>
      <SUPPLIER_PID>285129</SUPPLIER_PID>
      <PRODUCT_DETAILS>
      <DESCRIPTION_SHORT lang=“pol”></DESCRIPTION_SHORT>
      <DESCRIPTION_LONG lang=“pol”></DESCRIPTION_LONG>
      <EAN></EAN>
      <SUPPLIER_ALT_PID></SUPPLIER_ALT_PID>
      <MANUFACTURER_PID></MANUFACTURER_PID>
      <MANUFACTURER_NAME></MANUFACTURER_NAME>
      <MANUFACTURER_TYPE_DESCR></MANUFACTURER_TYPE_DESCR>
      <SPECIAL_TREATMENT_CLASS type=“NOT_RELEVANT”>NONE</SPECIAL_TREATMENT_CLASS>
      <KEYWORD lang=“pol”></KEYWORD>
      </PRODUCT_DETAILS>
      <PRODUCT_ORDER_DETAILS>
      <ORDER_UNIT>C62</ORDER_UNIT>
      <CONTENT_UNIT>C62</CONTENT_UNIT>
      <NO_CU_PER_OU>1</NO_CU_PER_OU>
      <PRICE_QUANTITY>1</PRICE_QUANTITY>
      <QUANTITY_MIN>1</QUANTITY_MIN>
      <QUANTITY_INTERVAL>1</QUANTITY_INTERVAL>
      </PRODUCT_ORDER_DETAILS>
      <PRODUCT_PRICE_DETAILS>
      <DATETIME>
      <DATE>2016-01-26</DATE>
      </DATETIME>
      <PRODUCT_PRICE>
      <PRICE_AMOUNT></PRICE_AMOUNT>
      <PRICE_CURRENCY>EUR</PRICE_CURRENCY>
      <TAX>0.19</TAX>
      <LOWER_BOUND>1</LOWER_BOUND>
      </PRODUCT_PRICE>
      </PRODUCT_PRICE_DETAILS>
      </PRODUCT>

      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?

      1 Reply Last reply Reply Quote 0
      • gerdb42G Offline
        gerdb42
        last edited by

        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.

        1 Reply Last reply Reply Quote 1

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors