I’m trying to programatically modify some XML elements using PHP. They have the form
<string name="myname1">myvalue1</string>
<string name="myname2">myvalue2</string>
etc. I do not have control over the incoming structure of this XML file. Is there a good way to edit these in PHP? I’ve tried using a DOMDocument, but I’m not having much luck making it work because the elements don’t have IDs specified and doing a search by tag name gives me all the strings, not the one I want. Thanks for any pointers.
DOMXPath solves this problem nicely: