You are here: Re: Xml parser performance and Xml generation « PHP Programming Language « IT news, forums, messages
Re: Xml parser performance and Xml generation

Posted by Steve on 09/05/07 16:54

"Bastien Continsouzas" <dev@continsouzas.com> wrote in message
news:1189006678.130208.175550@19g2000hsx.googlegroups.com...
> Hello,
>
> I need to parse relatively small XML files (less than 100 kB) and to
> write XML files that can get quite big (the bigger I can get without
> having performance issues, the better).

i don't think you'll notice any appreciable difference between parsers with
file sizes that small.

> I'd also like to know if writing the XML file using plain strings
> would be a lot faster and/or would use a lot less memory than using a
> parser to build them. And if I choose this option, what is the fastest
> way to build big strings in PHP ?

it all depends on the xml you are writing. will your output contain
marked-up elements (data typing, etc.) or will it be as simple as:

<records>
<record>
<field1 />
<field2 />
<etc />
</record>
</records>

will it be stand-alone or pull schema info into the mix?

it will always be quicker to put it together yourself...however, doing so
can complicate the maintenance of the script doing the output and you could
be very prone to duplicating your code. that's if your script is written in
procedural contexts.

having said that, you do not need a parser to ever output your xml. to avoid
the afformentioned, you could make appropriate class objects that describe
your data, then give them a toXml() function where you use that information
to build the appropriate output. this is fundamentally different than
procedural code and is what i recommend...especially since you can do so
many other things with the object, like providing a toCsv() interface and
things of that nature including extending the object to create slightly
different variants that may need to 'look' different based on the overall
xml you'd be including it into - it may even depend on having a different
'look' based on the client for whom you are producing it.

just a thought.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация