How can I remove an element when parsing XML with Ox?
Ox has an append method - (Object) <<(node) but doesn’t seem to have a - (Element) remove method. Nokogiri has a remove function, does Ox have an equivalent?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Consider this document:
Now you can observe:
Your nodes are just a regular ruby array.
And thus you have all the Enumerable functionality combined with the Array facilities of Ruby.
To delete the element we’ve created above, you can do this:
Or an index-based removal if that’s what you need:
Hope this helps