Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a pipe-friendly program that takes:

  • An XML document
  • An XPath expression indicating the target element(s)
  • The desired replacement

? Something like sed but knowledgeable about XML (elements, whitespace, etc.)?

share|improve this question
add comment

2 Answers

If you don't mind using/learning XSLT, there is the xsltproc utility which can accomplish this.

share|improve this answer
add comment

XMLSH has a command xed that might fit your parameters.

xed evaluate an xpath expression and edits every matching node outputing the result document

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.