hungryfrank Posted November 2, 2016 Share Posted November 2, 2016 first of all let me say that i have no idea about coding. when i went to school we used punch cards now here is the question in the code that i have $responseDoc = new DomDocument(); $responseDoc->loadXML($responseXml); but it is very hard for me to use DomDocument. it would be hundreds of lines (i had a program thet stopped working and i want to just make changes to that) i want to do a way that i can just have lines like $BestOfferCount = $Item->BestOfferDetails->BestOfferCount; i hope i am making myself clear. thanks for your help Quote Link to comment Share on other sites More sharing options...
Barand Posted November 2, 2016 Share Posted November 2, 2016 Have you tried using simpleXML? http://uk1.php.net/manual/en/simplexml.examples-basic.php Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted November 2, 2016 Author Share Posted November 2, 2016 no i changed it to $resp = new simplexml_load_file($responseXml); if ($resp->Ack == "Success") { echo 'success';} but it doesn't i might add that the xml file is nested Quote Link to comment Share on other sites More sharing options...
hungryfrank Posted November 2, 2016 Author Share Posted November 2, 2016 this works $responseDoc = new DomDocument(); $responseDoc->loadXML($responseXml); //get any error nodes $errors = $responseDoc->getElementsByTagName('Ack'); $code = $errors->item(0)->getElementsByTagName('Ack'); // if($code=='Success') { echo 'success';} Quote Link to comment Share on other sites More sharing options...
requinix Posted November 2, 2016 Share Posted November 2, 2016 "$resp->Ack" would only have worked if was a child of the root element. Sounds like it wasn't, but I can't be sure because you didn't post the XML you're working with. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.