Re: LoadXML trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx <mailto:danitao.mailists@xxxxxxxxx>> 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux