Set predefined value into xml path : XML Path « XML « PHP






Set predefined value into xml path

<?php
   $xml = simplexml_load_file("contact.xml");
   $book = $xml->xpath("/contact/personal[title='Manager']");
   echo $book[0]->title;
?>

<!--
<contact id="43956">
     <personal>
          <name>
               <first>J</first>
               <middle>J</middle>
               <last>J</last>
          </name>
          <title>Manager</title>
          <employer>National Company</employer>
          <dob>1951-02-02</dob>
     </personal>
</contact>


-->

           
       








Related examples in the same category

1.XML Path in action