I've taken the time to make a bunch of changes to ext/xml over the past
few days:

XML_ExternalEntityParserCreate():
        resource xml_external_entity_parser_create(resource orig_parser,
            string context [, string encoding])
        Creates an external entity parser suitable for parsing DTD
        declarations (if expat is compiled with XML_DTD) and external
        parsed entities. The only functions that should be invoked against
        this parser are xml_parse; nothing else will cause an error, but
        will likely cause memory leaks.
XML_SetCommentHandler()
        int xml_set_comment_handler(resource parser, string hdl)
        hdl is: void commentHandler(resource parser, string data)
        Registers a handler for comments.
XML_SetCdataSectionHandler()
        int xml_set_cdata_section_handler(resource parser,
            string startHdl, string endHdl)
        startHdl is: void startCdataSection(resource parser)
        endHdl is: void endCdataSection(resource parser)
        Registers a handler to be called at the beginning and end of a
        <![CDATA[]]> section.
XML_SetParamEntityParsing()
        Created new defintions:
                XML_OPTION_PARAM_ENTITY_PARSING
                XML_PARAM_ENTITY_PARSING_NEVER
                XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
                XML_PARAM_ENTITY_PARSING_ALWAYS
        Implemented with xml_set_option(XML_OPTION_PARAM_ENTITY_PARSING),
        expects one of the XML_PARAM_ENTITY_PARSING_* constants.
        Enables or disables parameter entity parsing (including DTDs if
        expat is compiled with XML_DTD).
XML_SetElementDeclHandler()
        int xml_set_element_decl_handler(resource parser, string hdl)
        hdl is: void elementDeclHandler(resorce parser, string element,
                     array model)
        Registers a handler to be called for <!ELEMENT> declarations in a
        DTD.
XML_SetAttlistDeclHandler()
        int xml_set_attlist_decl_handler(resource parser, string hdl)
        hdl is: void attlistDeclHandler(resource parser, string elementName,
                     string attributeName, string type, string default,
                     int is_required)
        Registers a handler to be called for <!ATTLIST> declarations in a
        DTD. Handler is called once for each attribute specified in the
        <!ATTLIST> declaration.
XML_SetXmlDeclHandler()
        int xml_set_xml_decl_handler(resource parser, string hdl)
        hdl is: void xmlDeclHandler(resource parser, string version,
                     string encoding, int is_standalone)
        Registers a handler to be called for <?xml?> declarations.
        'standalone' is -1 if unspecified in the xml declaration, 0 if
        standalone='no', and 1 if 'standalone='yes'.
 XML_SetDoctypeDeclHandler()
        int xml_set_doctype_decl_handler(resource parser,
            string startDecl, string endDecl)
        startDecl is: void startDoctypeDeclHandler(resource parser,
                     string doctypeName, string systemId,
                     string publicId, int has_internal_subset)
        endDecl is: void endDoctypeDeclHandler(resource parser)
        Registers a handler to be called for the beginning and
        end of parsing of <!DOCTYPE> declarations.
XML_SetEntityDeclHandler()
        int xml_set_entity_decl_handler(resource parser, string hdl)
        hdl is: void entityDeclHandler(resource parser, string entityName,
                     int is_parameter_entity, string value, string base,
                     string systemId, string publicId, string notationName)
        Registers a handler for <!ENTITY> declarations.
XML_GetIdAttributeIndex()
        array xml_get_last_id_attribute(resource parser)
                Returns ID attribute from current call to the start
                element handler. Only works from within start element
                handler; returns false otherwise. Array contains name,
                value.
XML_GetSpecifiedAttributeCount()
        array xml_get_specified_attributes(resource parser)
                Returns array containing only explicitly specified
                attributes for the current call to the start element
                handler. Only works from within start element handler,
                returns false otherwise. Array contains mapping of
                name=>value pairs.
        array xml_get_default_attributes(resource parser)
                Returns array containing only default attributes
                (attributes contaied in an <!ATTLIST> declaration with a
                default value specified.) Only works from within start
                element handler, returns false otherwise. Array contains
                mapping of name=>value pairs.

The 'xml_parser' structure was changed to have a 'parent' parser field
(for external entities). xml_parser_dtor() doesn't destroy any of the
fields in 'xml_parser' if the parser is for an external entity. A
'last_attributes' field was added to support the use of
XML_GetIdAttributeIndex() and XML_GetSpecifiedAttributeCount().

_xml_elementDeclHandler() requires the function XML_FreeContentModel(),
which only appears to be avaliable in more recent versions of expat than
is provided in ext/xml/expat.

The patch implementing these changes can be found at:
http://4.61.245.27/~chrisv/xml.diff. It is known to work with current HEAD
and expat-1.95.6.

Chris




-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to