Hello,
I just wanted to put this out there and see if anyone can recommend a better way to do this (if there is one). I am using phpDOM to retrieve node values from an XML document. I currently use the following code to do this:
/ Include the phpDOM - library /
define( "PHPDOM_INCLUDE_DIR", "lib/" );
include(PHPDOM_INCLUDE_DIR . "domxml_document.php" );
/* Use the Library */
$doc = new Document;
/* Use the XML file from sample2! */
$doc->createFromFile( "paymentech_response_sample.xml" );
/* Retrieving a single element value */
$MerchantNode = $doc->getElementsByTagName( "MerchantID" );
$MerchantID = $MerchantNode->item( 0 );
if(is_object($MerchantID)) echo $MerchantID->getNodeValue();
This returns the value of MerchantID. While everything seems to work it does seem a little long just to receive a single value. Can anyone come up with a way to retrieve values in perhaps a single line (from the $MerchantNode section onwards)?
Thanks for any input,
Jacob