Date: 10/27/98
- Next message: ssb: "[PHP-DEV] CVS update: php3/doc/functions"
- Previous message: zeev: "[PHP-DEV] CVS update: php3/doc/functions"
- Next in thread: ssb: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tuesday October 27, 1998 @ 14:56
Author: ssb
Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv10207/functions
Modified Files:
xml.c php3_xml.h
Log Message:
XML encoding support
Index: php3/functions/xml.c
diff -c php3/functions/xml.c:1.10 php3/functions/xml.c:1.11
*** php3/functions/xml.c:1.10 Sat Oct 24 01:48:13 1998
--- php3/functions/xml.c Tue Oct 27 14:56:41 1998
***************
*** 27,33 ****
+----------------------------------------------------------------------+
*/
! /* $Id: xml.c,v 1.10 1998/10/24 05:48:13 eschmid Exp $ */
#define IS_EXT_MODULE
#if COMPILE_DL
# if PHP_31
--- 27,33 ----
+----------------------------------------------------------------------+
*/
! /* $Id: xml.c,v 1.11 1998/10/27 19:56:41 ssb Exp $ */
#define IS_EXT_MODULE
#if COMPILE_DL
# if PHP_31
***************
*** 191,196 ****
--- 191,198 ----
XML_GLOBAL(php3_xml_module).le_xml_parser =
register_list_destructors(xml_destroy_parser, NULL);
+ XML_GLOBAL(php3_xml_module).default_encoding = "ISO-8859-1";
+
REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
***************
*** 695,714 ****
/************************* EXTENSION FUNCTIONS *************************/
! /* {{{ int Xml_Parser_Create() */
PHP_FUNCTION(xml_parser_create)
{
xml_parser *parser;
! int id;
XML_TLS_VARS;
! if (ARG_COUNT(ht) != 0) {
WRONG_PARAM_COUNT;
}
parser = ecalloc(sizeof(xml_parser), 1);
! parser->parser = XML_ParserCreate(NULL);
XML_SetUserData(parser->parser, parser);
XML_SetElementHandler(parser->parser, php3i_xml_startElementHandler, php3i_xml_endElementHandler);
XML_SetCharacterDataHandler(parser->parser, php3i_xml_characterDataHandler);
--- 697,741 ----
/************************* EXTENSION FUNCTIONS *************************/
! /* {{{ int xml_parser_create() */
PHP_FUNCTION(xml_parser_create)
{
xml_parser *parser;
! int id, argc;
! pval *encodingArg = NULL;
! XML_Char *encoding;
! char thisfunc[] = "xml_parser_create";
XML_TLS_VARS;
+
+ argc = ARG_COUNT(ht);
! if (argc > 1 || getParameters(ht, argc, &encodingArg) == FAILURE) {
WRONG_PARAM_COUNT;
}
+ if (argc == 1) {
+ convert_to_string(encodingArg);
+ if (strncasecmp(encodingArg->value.str.val, "ISO-8859-1",
+ encodingArg->value.str.len) == 0) {
+ encoding = "ISO-8859-1";
+ } else if (strncasecmp(encodingArg->value.str.val, "UTF-8",
+ encodingArg->value.str.len) == 0) {
+ encoding = "UTF-8";
+ } else if (strncasecmp(encodingArg->value.str.val, "US-ASCII",
+ encodingArg->value.str.len) == 0) {
+ encoding = "US-ASCII";
+ } else if (strncasecmp(encodingArg->value.str.val, "UTF-16",
+ encodingArg->value.str.len) == 0) {
+ php3_error(E_WARNING, "%s: unsupported encoding", thisfunc);
+ RETURN_FALSE;
+ }
+ } else {
+ encoding = XML_GLOBAL(php3_xml_module).default_encoding;
+ }
+
parser = ecalloc(sizeof(xml_parser), 1);
! parser->parser = XML_ParserCreate(encoding);
XML_SetUserData(parser->parser, parser);
XML_SetElementHandler(parser->parser, php3i_xml_startElementHandler, php3i_xml_endElementHandler);
XML_SetCharacterDataHandler(parser->parser, php3i_xml_characterDataHandler);
***************
*** 718,724 ****
XML_SetNotationDeclHandler(parser->parser, php3i_xml_notationDeclHandler);
XML_SetExternalEntityRefHandler(parser->parser, php3i_xml_externalEntityRefHandler);
id = php3_list_insert(parser, XML_GLOBAL(php3_xml_module).le_xml_parser);
! parser = xml_get_parser(id, "xml_parser_create", list);
parser->index = id;
parser->case_folding = 1;
--- 745,751 ----
XML_SetNotationDeclHandler(parser->parser, php3i_xml_notationDeclHandler);
XML_SetExternalEntityRefHandler(parser->parser, php3i_xml_externalEntityRefHandler);
id = php3_list_insert(parser, XML_GLOBAL(php3_xml_module).le_xml_parser);
! parser = xml_get_parser(id, thisfunc, list);
parser->index = id;
parser->case_folding = 1;
Index: php3/functions/php3_xml.h
diff -c php3/functions/php3_xml.h:1.4 php3/functions/php3_xml.h:1.5
*** php3/functions/php3_xml.h:1.4 Fri Oct 23 07:18:23 1998
--- php3/functions/php3_xml.h Tue Oct 27 14:56:41 1998
***************
*** 39,44 ****
--- 39,45 ----
typedef struct {
int le_xml_parser;
+ XML_Char *default_encoding;
} xml_module;
typedef struct {
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: ssb: "[PHP-DEV] CVS update: php3/doc/functions"
- Previous message: zeev: "[PHP-DEV] CVS update: php3/doc/functions"
- Next in thread: ssb: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

