Re: Planning to create Array -> XML extension

From: Date: Tue, 15 Jul 2008 07:36:08 +0000
Subject: Re: Planning to create Array -> XML extension
References: 1 2 3 4  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-5620@lists.php.net to get a copy of this message
> I think, you will start to notice difference if arrays contain 1000+ elements. Unfortunately, 100+. I suspect that PHP concatenation operator (".") is inefficient because of multiple memory reallocation and copy operations performed (there is no Java StringBuffer analog in PHP), so I am planning to perform thes operations in C memory "doubled-reallocation" algorythm. (Direct using of PHP's libxml's appendChild() via PHP calls is even slower, it's tested.) And the resulting XML may be about 300-400K (bad, but can't do anything with that, it's the legacy architecture issue). These 300K are parsed by libxslt in 2-3ms (very fast!), but generated from arrays for about 100-200ms in pure PHP (very slow). It's a real problem... > There is a php extension to generate JSON and it should be no problem to go from JSON to XML in Java. The language is PHP, so I don't want to use Java. The processor is http://php.net/xsl On Tue, Jul 15, 2008 at 1:39 AM, Christoph Dorn <christoph@christophdorn.com> wrote: > > 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. > > What language is the XSLT processor running in? > > You could try going from PHP Arrays to JSON to XML if your XSLT is > running in java for instance. There is a php extension to generate JSON > and it should be no problem to go from JSON to XML in Java. > > Christoph > > > -- > PECL development discussion Mailing List (http://pecl.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pecl.dev (#5620) next »