cvs: php4 /ext/domxml php_domxml.c php_domxml.h

From: Date: Fri, 14 Jun 2002 12:37:29 +0000
Subject: cvs: php4 /ext/domxml php_domxml.c php_domxml.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12361@lists.php.net to get a copy of this message
chregu Fri Jun 14 08:37:29 2002 EDT Modified files: /php4/ext/domxml php_domxml.c php_domxml.h Log: - 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) Index: php4/ext/domxml/php_domxml.c diff -u php4/ext/domxml/php_domxml.c:1.171 php4/ext/domxml/php_domxml.c:1.172 --- php4/ext/domxml/php_domxml.c:1.171 Fri Jun 14 08:20:13 2002 +++ php4/ext/domxml/php_domxml.c Fri Jun 14 08:37:28 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.c,v 1.171 2002/06/14 12:20:13 chregu Exp $ */ +/* $Id: php_domxml.c,v 1.172 2002/06/14 12:37:28 chregu Exp $ */ /* TODO * - Support Notation Nodes @@ -237,8 +237,10 @@ 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 @@ 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 @@ } /* }}} */ -/* {{{ 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 @@ } /* }}} */ -/* {{{ 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; @@ -4176,6 +4180,51 @@ RETURN_TRUE; } /* }}} */ + +/* {{{ 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 */ Index: php4/ext/domxml/php_domxml.h diff -u php4/ext/domxml/php_domxml.h:1.60 php4/ext/domxml/php_domxml.h:1.61 --- php4/ext/domxml/php_domxml.h:1.60 Fri Jun 14 08:20:13 2002 +++ php4/ext/domxml/php_domxml.h Fri Jun 14 08:37:28 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_domxml.h,v 1.60 2002/06/14 12:20:13 chregu Exp $ */ +/* $Id: php_domxml.h,v 1.61 2002/06/14 12:37:28 chregu Exp $ */ #ifndef PHP_DOMXML_H #define PHP_DOMXML_H @@ -189,9 +189,11 @@ 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);

« previous php.cvs (#12361) next »