0

Is there a better way to remove selected nodes from XML using Javascript? I see that removeChild() method can be used. But I don't want to traverse through the entire XML tree right to the bottom where the to-be replaced node is stuck. In simple, I should be able to fly right to my node of interest and replace its contents.

2 Answers 2

1

Check out http://api.jquery.com/jQuery.parseXML/

$.parseXML("well formed xml document").find('css selector to find element to remove').remove()

Sign up to request clarification or add additional context in comments.

Comments

0

What about using XPath? It should be implemented in every modern browser.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.