Extension to return SimpleXML object

View: New views
3 Messages — Rating Filter:   Alert me  

Extension to return SimpleXML object

by Tony Ser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We are implementing our own extension and in a lot of cases we would like to
return complex data.
XML will be a natural choice except that we don't want to format the complex
data into string, return the xml string and have the PHP Script parse it
before manipulating the content. It will be very inefficient.

Wonder if there is a way to return the standard SimpleXML object and the
script will able to use it right away.
Or any other suggestion to return complex data ?



Thanks!
Tony



--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Extension to return SimpleXML object

by Pierre Joye :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

On Fri, Jun 27, 2008 at 6:41 PM, Tony Ser <tser@...> wrote:

> Hi,
>
> We are implementing our own extension and in a lot of cases we would like to
> return complex data.
> XML will be a natural choice except that we don't want to format the complex
> data into string, return the xml string and have the PHP Script parse it
> before manipulating the content. It will be very inefficient.
>
> Wonder if there is a way to return the standard SimpleXML object and the
> script will able to use it right away.
> Or any other suggestion to return complex data ?

Create a class as storage for your complex data? This class can still
have a method exportAsXml, or getAsJsonl or whatever is the desired
format.

Cheers,
--
Pierre

http://blog.thepimp.net | http://www.libgd.org

--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Extension to return SimpleXML object

by Alexey Zakhlestin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jun 27, 2008 at 8:41 PM, Tony Ser <tser@...> wrote:

>
> We are implementing our own extension and in a lot of cases we would like to
> return complex data.
> XML will be a natural choice except that we don't want to format the complex
> data into string, return the xml string and have the PHP Script parse it
> before manipulating the content. It will be very inefficient.
>
> Wonder if there is a way to return the standard SimpleXML object and the
> script will able to use it right away.
> Or any other suggestion to return complex data ?

Just return objects, which can be used to later serialize data into
xml, yaml, json or even php's serialize()
objects are the most flexible solution

--
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

LightInTheBox - Buy quality products at wholesale price