php - How to ge two fields with one XPath? -


i have xpath gets div want read. how read class , name of div 1 xpath?

<?php          $xmldoc = new domdocument();          $xmldoc->load( '<<your file>>>' );      //$xmldoc->loadhtml($sourcestring); //-> if string have         $xpath = new domxpath($doc);         $elements = $xpath->query("your xpath");          //if sure there 1 div, xpath, can use index 0 in next statement, else uou have itereate in loop      $node = $elements->item(0);      $attrib1 = $node->attributes->getnameditem("<attribute_name1>");     $attrib2 = $node->attributes->getnameditem("<attribute_name2>");     $attrib3 = $node->attributes->getnameditem("<attribute_name3>");     ....            ?>  

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -