Author Topic: Skip source if some words is found at a specific xml element  (Read 3131 times)

nuno

  • Newbie
  • *
  • Posts: 13
Hi
How can I filter to skip a source if I found an expression or part of it in a specific xml element?
Example.
Im parsing a XML file wich have these nodes:

<title>Hello!</title>
<link>www.site.com/programs/tuesdaynights/2022/02/28/</link>

I want to write only the title but if the link contains the word "programs" then skip to next text source or write a custom text.
Is it possible?

Thanks

Jan

  • Hero Member
  • *****
  • Posts: 1069
Re: Skip source if some words is found at a specific xml element
« Reply #1 on: August 16, 2022, 08:45:15 pm »
  • Using the Output template, encapsulate the 'link' element into any unique substring.
    For example, if %1% is title and %2% is link:
    %1%<<%2%>>
  • Use the Text Replacing to test if the substring contains the keyword
    Change %REGEXP%<<.*programs.*>> to %GOTONEXT%
  • Remove the substring from final text
    Change %REGEXP%<<.*>> to (nothing)

Alternatively you may apply JavaScript to the same Output template, if further filtering or conditions are required.

nuno

  • Newbie
  • *
  • Posts: 13
Re: Skip source if some words is found at a specific xml element
« Reply #2 on: August 17, 2022, 11:40:41 am »
That works!
Thank you!