tags:

views:

100

answers:

3

What are the recommended libraries for XML in PHP? Advantages? Looking to create/send/parse XML. Needs to support High Volume (Millions of calls per day)

A: 

SimpleXml is by far the easiest! For any of the missing features in SimpleXml you can try bXml, a warper library I wrote.

null
Needs to support High Volume (Millions of calls per day)
Phill Pafford
Yep, should work just fine.
null
The data is parsed then directly stored in Oracle DB. It more of a request/post xml functionality instead of parsing a file, would this still be suggested to use?
Phill Pafford
A: 

If you want use PHP intern XML Parser there are

XPATH DOM SimpleXml

Or If you want to use a XML Parser for PHP i can recommend Simplepie

there are a lot but Simplepie is one of the Best.

Here is a Simple overview of how you could use it.

<?php
require_once('simplepie.inc');

$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->init();
$feed->handle_content_type();
?>

<h1><a href="<?php echo $feed->get_permalink(); ?>">
<?php echo $feed->get_title(); ?></a></h1>
<p><?php echo $feed->get_description(); ?></p>

<?php foreach ($feed->get_items(0, 5) as $item): ?>

<h2 class="title"><a href="<?php echo $item->get_permalink(); ?>">
<?php echo $item->get_title(); ?></a></h2>
<?php echo $item->get_description(); ?>
<p>
<small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?>
</small></p>

<?php endforeach; ?>
streetparade
I'm not working with a DOM, more of a xml request/post functionality
Phill Pafford
+2  A: 

PHP supports a number of XML libraries.

If memory is an issue, for instance due to large files, use an Event-based parser over a tree-based one.Tree-based parsers must fully load the file into memory in order to parse the XML. Event-based parsers do not need to load the entire file into memory to begin parsing.

See this article about what's new with XML in PHP5 and a discussion of their pros and cons.

You might also reconsider where you store the data, since filesystem might be too slow for millions of calls. How about Xindice?

Gordon
memory is not an issue but performance is what I'm looking for.
Phill Pafford
The data is parsed then directly stored in Oracle DB. It more of a request/post xml functionality
Phill Pafford
Sounds like Pull Parsing. See http://www.ibm.com/developerworks/library/x-pullparsingphp.html in which case XmlReader should be pretty fast.
Gordon