simplexml problem

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

 



Hi all!

I'm using simplexml to load an xml into an object.
The XML is this:
<?xml version="1.0"?>
<request>
 <customerID>3</customerID>
 <appName>agenda</appName>
 <ticketType>cticket_agenda_server</ticketType>
 <ticketTypeID>1</ticketTypeID>
 <platformID>1</platformID>
 <ticketAction>addUsersToGroup</ticketAction>
</request>

When I do this:

$file = simplexml_load_file( 'file.xml' );
$ticketType = $file->ticketType;

What i really have into $ticketType is a SimpleXMLElement... not the value "cticket_agenda_server"... What am I doing wrong?

Because if I echo this value... Yes, I obtain the "cticket_agenda_server"... But if I want to use like:

$ticket = new $ticketType( $param1, $param2);

It throws:
Uncaught exception 'Exception' with message 'SimpleXMLElement::__construct() expects parameter 1 to be string, array given' in C:\Dani\htdocs\ticket_server\ticket_execute.php:134
Stack trace:
#0 C:\Dani\htdocs\ticket_server\ticket_execute.php(134): SimpleXMLElement->__construct(Array, Object(clogger))
#1 {main}
 thrown

It seems like it uses $ticketType class instead the value inside.

Than you in advance

--
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