From f9325a6a29fc608ff32ff51c04d0463fa627fd79 Mon Sep 17 00:00:00 2001 From: Christian Stocker Date: Fri, 14 Jun 2002 12:37:28 +0000 Subject: [PATCH] - renamed domxml_parser_reference to domxml_parser_entitiy_reference - renamed domxml_cdata_block to domxml_parser_cdata_section (more consistent with the domxml_create_XXX methods) - added domxml_parser_processing_instruction(target,data) - added domxml_parser_namespace_decl(href,prefix) --- ext/domxml/php_domxml.c | 65 ++++++++++++++++++++++++++++++++++++----- ext/domxml/php_domxml.h | 6 ++-- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c index 10627f7ff7..eafb4822a3 100644 --- a/ext/domxml/php_domxml.c +++ b/ext/domxml/php_domxml.c @@ -237,8 +237,10 @@ static zend_function_entry domxml_functions[] = { PHP_FE(domxml_parser_end_element, NULL) PHP_FE(domxml_parser_comment, NULL) PHP_FE(domxml_parser_characters, NULL) - PHP_FE(domxml_parser_reference, NULL) - PHP_FE(domxml_parser_cdata_block, NULL) + PHP_FE(domxml_parser_entity_reference, NULL) + PHP_FE(domxml_parser_processing_instruction, NULL) + PHP_FE(domxml_parser_cdata_section, NULL) + PHP_FE(domxml_parser_namespace_decl, NULL) PHP_FE(domxml_parser_start_document, NULL) PHP_FE(domxml_parser_end_document, NULL) PHP_FE(domxml_parser_get_document, NULL) @@ -330,9 +332,11 @@ static function_entry php_domxmlparser_class_functions[] = { PHP_FALIAS(start_element, domxml_parser_start_element, NULL) PHP_FALIAS(end_element, domxml_parser_end_element, NULL) PHP_FALIAS(characters, domxml_parser_characters, NULL) - PHP_FALIAS(reference, domxml_parser_reference, NULL) - PHP_FALIAS(cdata_block, domxml_parser_cdata_block, NULL) + PHP_FALIAS(entity_reference, domxml_parser_entity_reference, NULL) + PHP_FALIAS(processing_instruction, domxml_parser_processing_instruction, NULL) + PHP_FALIAS(cdata_section, domxml_parser_cdata_section, NULL) PHP_FALIAS(comment, domxml_parser_comment, NULL) + PHP_FALIAS(namespace_decl, domxml_parser_namespace_decl, NULL) PHP_FALIAS(start_document, domxml_parser_start_document, NULL) PHP_FALIAS(end_document, domxml_parser_end_document, NULL) PHP_FALIAS(get_document, domxml_parser_get_document, NULL) @@ -4111,9 +4115,9 @@ PHP_FUNCTION(domxml_parser_comment) } /* }}} */ -/* {{{ proto bool domxml_parser_cdata_block(string chunk) +/* {{{ proto bool domxml_parser_cdata_section(string chunk) adds a cdata block */ -PHP_FUNCTION(domxml_parser_cdata_block) +PHP_FUNCTION(domxml_parser_cdata_section) { zval *id; xmlParserCtxtPtr parserp; @@ -4155,9 +4159,9 @@ PHP_FUNCTION(domxml_parser_characters) } /* }}} */ -/* {{{ proto bool domxml_parser_reference(string reference) +/* {{{ proto bool domxml_parser_entity_reference(string reference) Adds entity reference */ -PHP_FUNCTION(domxml_parser_reference) +PHP_FUNCTION(domxml_parser_entity_reference) { zval *id; xmlParserCtxtPtr parserp; @@ -4177,6 +4181,51 @@ PHP_FUNCTION(domxml_parser_reference) } /* }}} */ +/* {{{ proto bool domxml_parser_processing_instruction(string target, string data) + Adds processing instruction */ +PHP_FUNCTION(domxml_parser_processing_instruction) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *data,*target; + int data_len, target_len; + + DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &target, &target_len, &data, &data_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + processingInstruction(parserp, (xmlChar *) target, (xmlChar *) data); + + RETURN_TRUE; +} +/* }}} */ + +/* {{{ proto bool domxml_parser_namespace_decl(string href, string prefix) + Adds namespace declaration */ +PHP_FUNCTION(domxml_parser_namespace_decl) +{ + zval *id; + xmlParserCtxtPtr parserp; + char *href,*prefix; + int href_len, prefix_len; + + DOMXML_PARAM_FOUR(parserp, id, le_domxmlparserp,"ss", &href, &href_len, &prefix, &prefix_len); + + if (parserp->myDoc == NULL) { + php_error(E_WARNING, "%s(): Document was not started", get_active_function_name(TSRMLS_C)); + RETURN_FALSE; + } + + namespaceDecl(parserp, (xmlChar *) href, (xmlChar *) prefix); + + RETURN_TRUE; +} +/* }}} */ + + /* {{{ proto bool domxml_parser_add_chunk(string chunk) adds xml-chunk to parser */ PHP_FUNCTION(domxml_parser_add_chunk) diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h index de15d5bbd1..c016dbdc05 100644 --- a/ext/domxml/php_domxml.h +++ b/ext/domxml/php_domxml.h @@ -189,9 +189,11 @@ PHP_FUNCTION(domxml_parser_set_keep_blanks); PHP_FUNCTION(domxml_parser_start_element); PHP_FUNCTION(domxml_parser_end_element); PHP_FUNCTION(domxml_parser_characters); -PHP_FUNCTION(domxml_parser_reference); +PHP_FUNCTION(domxml_parser_entity_reference); PHP_FUNCTION(domxml_parser_comment); -PHP_FUNCTION(domxml_parser_cdata_block); +PHP_FUNCTION(domxml_parser_cdata_section); +PHP_FUNCTION(domxml_parser_namespace_decl); +PHP_FUNCTION(domxml_parser_processing_instruction); PHP_FUNCTION(domxml_parser_start_document); PHP_FUNCTION(domxml_parser_end_document); PHP_FUNCTION(domxml_parser_get_document); -- 2.40.0