title: PHP SIMPLEXML XPATH match multiple tags with same substring
body: <p>I am doing a simple script that takes an XML as input, modifies some values, and saves it with another name.</p>
  
  <p>The XML has multiple namespaces, often nested.</p>
  
  <p>I am trying to find a clever solution to the following problem.</p>
  
  <p>I have multiple tags which have a common substring, for instance Episode</p>
  
  <pre><code>&lt;ext:EpisodeLong&gt;Test&lt;/ext:EpisodeLong&gt;
  &lt;ext:EpisodeBrief&gt;Test&lt;/ext:EpisodeBrief&gt;
  &lt;ext:EpisodeName&gt;Test&lt;/ext:EpisodeName&gt;
  </code></pre>
  
  <p>I want to access each and every tag that matches "Episode" and modify the value.</p>
  
  <p>Relevant snipped of XML:</p>
  
  <pre><code>&lt;Title endDateTime="2015-05-21T04:06:48Z" providerVersionNum="1" startDateTime="2015-05-02T04:06:48Z" uriId="c5.channel5.com/TITL0000000000001360"&gt;
      &lt;core:Ext xmlns:core="http://www.cablelabs.com/namespaces/metadata/xsd/core/1"&gt;
          &lt;ext:LocalizableTitleExt xmlns:ext="URN:NNDS:CMS:ADI3:01"    
          &lt;xml:lang="eng"&gt;
              &lt;ext:EpisodeLong&gt;Test&lt;/ext:EpisodeLong&gt;
              &lt;ext:EpisodeBrief&gt;Test&lt;/ext:EpisodeBrief&gt;
              &lt;ext:EpisodeName&gt;Test&lt;/ext:EpisodeName&gt;
          &lt;/ext:LocalizableTitleExt&gt;
  </code></pre>
  
  <p>All xpaths I'm trying to do fail. If I do the line below, I fetch 99% of the XML, while I want everything under Title only.</p>
  
  <pre><code>$results = $xml-&gt;xpath('//*[contains(E:LocalizableTitleExt, Episode)]');
  foreach ($results as $s) 
  {
      echo "DEBUG, xpath has found: ".$s."&lt;br/&gt;";
      $elementsToRemove[] = $s;       
  }   
  </code></pre>
  
  <p>*assume all namespaces are registered already, E is ext, C is Core</p>
  
  <p>Ideas?</p>
  
  <p>Thanks in advance</p>
  
  <p>ps: cannot use DOM, only SimpleXML and XPATH</p>