Re: LoadXML trouble
| From: | Dani Castaños | Date: | Mon, 10 Dec 2007 17:08:57 +0000 |
| Subject: | Re: LoadXML trouble | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265613@lists.php.net to get a copy of this message | ||
Yep, it works when i do saveXML, but not on loadXML step...
The thing is... i'm trying to do something like this:
$request = $_POST['xml'];
$logger->debug( 'New ticket request' );
/**
* Parse XML request to obtain values
*/
$xml = new DOMDocument();
//$xml->validateOnParse = true;
$xml->loadXML( $request );
$customer_id = $xml->getElementsByTagName( 'customerID' )->item( 0 )->nodeValue;
$app_name = $xml->getElementsByTagName( 'appName' )->item( 0 )->nodeValue; $ticket_type = $xml->getElementsByTagName( 'ticketType' )->item( 0 )->nodeValue; $ticket_action = $xml->getElementsByTagName( 'ticketAction' )->item( 0 )->nodeValue; $ticket_params = $xml->getElementsByTagName( 'parameters' )->item( 0 )->childNodes;... Nathan Nobbe escribió:
On Dec 10, 2007 11:40 AM, Dani Castaños <danitao.mailists@gmail.com <mailto:danitao.mailists@gmail.com>> wrote:I've checked $request previously and is not empty... it has something like:<?xml version="1.0"?> <response> <ticketID>1197026188_ec76</ticketID> <status>KO</status> <errCode>500</errCode> <errMsg>Internal Server Error</errMsg> </response>have you been testing this in the context of your application, or have you also tried a focused test script? i would try something trivial, like: <?php $xml = <<<XML <?xml version="1.0"?> <response> <ticketID>1197026188_ec76</ticketID> <status>KO</status> <errCode>500</errCode> <errMsg>Internal Server Error</errMsg> </response> XML; $domDoc = new DOMDocument(); $domDoc->loadXML($xml); echo $domDoc->saveXML() . PHP_EOL; ?> just to ensure the DOM extension is available and working as expected. -nathan