parse xml file using simplexml

jakaka

New Member
Apologies if there is an obvious answer (and I know there are about 1000 of these similar questions) - but I have spent two days trying to attack this without success. I cannot seem to crack why I get a null response...Short background: the following works just fine\[code\]$xurl= new SimpleXMLElement('https://gptxsw.appspot.com/view/submissionList?formId=GP_v7&numEntries=1', NULL, TRUE);$keyname = $xurl->idList->id[0];echo $keyname;\[/code\]this provides a response: a unique key like uuid:d0721391-6953-4d0b-b981-26e38f05d2e5however I try a similar request (which ultimately would be based on first request) and get a failure. I've simplified code as follows...\[code\]$xdurl= new SimpleXMLElement('https://gptxsw.appspot.com/view/downloadSubmission?formId=GP_v7[@version=null%20and%20@uiVersion=null]/GP_v7[@key=uuid:d0721391-6953-4d0b-b981-26e38f05d2e5]', NULL, TRUE);$keyname2 = $xdurl->data->GP_v7->SDD_ID_N[0];echo $keyname2;\[/code\]this provides null. And if I try something like echo $xdurl->asXML(); I get an error response from the site (not from PHP). Do I need to eject from SimpleXMLElement for the second request? I've read about using XPath and about defining the namespace, but I'm not sure that either would be required: the second file does have two namespaces but one of them isn't used and the other has no prefix for elements. Plus I have tried variations of those - enough to think that my problem/error is either more global in nature (or oversight due to inexperience).For purposes of this request I have no control over the formatting of either XML file.
 
Back
Top