Re: Replacing expat with libxml

[email protected] (Harry Fuecks)
Newsgroups php.xml.dev
Message-ID <oproxkiubhq6i4c6@localhost>
Could it be worth bearing in mind a potential PEAR project to unify the 
various XML extensions (and even PHP based ) out there? Starting to be a 
pretty good selection out there;

SAX: expat, libxml
DOM: libxml, QDom (still maintained?)
XSLT: Sablotron, libxml, Xalan (http://www.nttslab.de/php_xalan/)

Would really help if any new PHP XML extensions could provide an API that 
makes them similar to the others so that PEAR could unify them (as with 
PEAR::DB) in a similar way to Java's JAXP specification.

Taking XSLT for example today with Sablotron and Xalan it's;

<?php
// Sablotron
$xslt = xslt_create();
$result = xslt_process($xslt, 'sample.xml', 'sample.xsl');

// Xalan (think this is how it works from a glance at the source code)
$result = xalan_process('sample.xml', 'sample.xsl');
?>

Perhaps PEAR could provide an interface "Transform" e.g.;

<?php
interface Tranform {
    function process ($xml,$xsl) {}
}

class SabTransform implements Tranform {
    var $processor;
    function __construct() {
        $this->processor= xslt_create():
    }
    function process($xml,$xsl) {
        return xslt_process($this->processor,$xml,$xsl);
    }
}

class XalanTransform implements Tranform {
    function process($xml,$xsl) {
        return xalan_process($this->processor,$xml,$xsl);
    }
}
?>

Certainly if the new libxml extension is going to provide a SAX API would 
be great to see this behave in a similar manner to expat so it's easy to 
unify with some classes.

Otherwise are there any plans for XML Schema support in particular 
validation? I've heard libxml provides something but don't know what. 
Schema validation would be a big help for working with SOAP/WSDL.

Anyway - many thanks for the great work your doing.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.