Re: Planning to create Array -> XML extension
| From: | Dmitry Koterov | Date: | Mon, 14 Jul 2008 20:55:34 +0000 |
| Subject: | Re: Planning to create Array -> XML extension | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5617@lists.php.net to get a copy of this message | ||
Thank you for your answer!
No, I'm looking a library *not* for a cross-platform
serialization/deserialization. The idea is simpler.
I need to convert PHP arrays to XML to feed the result into XSLT processor.
So, PHP code does not generate XML, it generates simple and plain arrays,
and these arrays are converted to XML to be used in XSLT MVC templating
system. XML is transparent in this case: it is used, but is never generated
manually and is not visible explicitly.
Manual Array-to-XML convertarion (using PHP foreach'es or even XMLWriter) is
too slow and becomes the bottleneck. I hope that PHP extension for
Array-to-XML will solve this bottleneck.
On Tue, Jul 15, 2008 at 12:04 AM, Alexey Zakhlestin <indeyets@gmail.com>
wrote:
> Hi, Dmitry.
>
> On Mon, Jul 14, 2008 at 11:55 PM, Dmitry Koterov <dmitry@koterov.ru>
> wrote:
> > Hello.
> >
> > I am planning to create a PECL extension which converts multi-dimensional
> > (nested) PHP arrays into an XML document.
> > E.g., array('a' => array('b' => 'c')) becomes
> > <a><b>c</b></a>.
> >
> > The main goal is to speedup this transformation greatly.
> >
> > Please say is there any similar extension (possibly not in PECL itself,
> but
> > somewhere) available?
> > Possibly I am planning to "contrive a bicycle"?
>
> The closest thing in "xml-world" is XMLWriter, I guess. So, the answer
> to your question is "no, there is no extension which does exactly
> that"
>
> On the other hand, if you need cross-platform data-exchange format,
> which is not necessarily XML, I may suggest YAML as alternative.
> PHP extension for YAML is here:
> http://pecl.php.net/package/syck
>
> serialization is as simple as:
> $string = syck_dump($array_or_anything_else);
>
> and retrieving:
> $array_or_anything_else = syck_load($string);
>
> --
> Alexey Zakhlestin
> http://blog.milkfarmsoft.com/
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>