0

I have a tree like this:

<feed>
  <entry>
    <apps:property name="includes" value="john@example.com"/>
    <apps:property name="excludes" value="mike@example.com"/>
  </entry>
  <entry>
    <apps:property name="includes" value="john@example.com"/>
    <apps:property name="excludes" value="john@example.com"/>
  </entry>
</feed>

I'd like to delete all <apps:property name="excludes"> in entries where there is the same value in "includes" and "excludes".

I.e. in this case, I want to delete the second <apps:property> in the second <entry>.

How do I do it using Nokogiri? I am a newbie at XML and I cannot find the correct methods in the Nokogiri docs.

jiroch
  • 414
  • 6
  • 19
  • 2
    Welcome to SO. Please read "[mcve]". We expect evidence of your effort. There are many examples of using Nokogiri here on Stack Overflow, which should help you figure out how to do what you want. Try, show us a minimal example of your code and explain why it fails. Also read http://meta.stackoverflow.com/q/261592/128421 as it gives an idea of the effort expected. You also might want to read "[ask]", including the links at the bottom. We don't care if you're a novice or an expert, just show the effort and ask a good question. We also need an example of the output you want. – the Tin Man Mar 18 '16 at 18:41
  • 1
    Perhaps these are relevant: http://stackoverflow.com/questions/1274783/inserting-and-deleting-xml-nodes-and-elements-using-nokogiri and http://stackoverflow.com/questions/1708504/how-do-i-remove-a-node-with-nokogiri – JLB Mar 18 '16 at 20:11

0 Answers0