Re: Lack of configuration support in SAX interface

From: Date: Fri, 09 Sep 2005 01:11:59 +0000
Subject: Re: Lack of configuration support in SAX interface
References: 1  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-566@lists.php.net to get a copy of this message
Jirka Kosek wrote:
is there a way how to configure SAX parser (xml_parser_create) similarly as DOM or SimpleXML? I mean specifying constants like LIBXML_NOENT, LIBXML_DTDLOAD, LIBXML_DTDATTR etc. to control parser behaviour. It seems that default behaviour of SAX parser is quite non-conforming to XML spec, it even doesn't expand references to internal entities.
Based on the extensions mentioned I assume this is under PHP 5.x and libxml is being used for the xml extension. It was designed for compatibility with the one under PHP 4 that used expat so behavior in 5 was based on behavior from 4. For example, expanding entity refs requires that no default handler is defined. In the event its an internal pre-defined entity, they only are not expanded when no character data handler is present. So to answer your initial question, no, there is not a way to currently do this while also keeping compatibility between libxml2 and expat. For this type of control you might want to look at xmlreader (though uses its own constants to control behavior and is not event based). Rob

« previous php.xml.dev (#566) next »