diff options
author | Marcus Boerger <helly@php.net> | 2002-10-29 11:59:24 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2002-10-29 11:59:24 +0000 |
commit | c9f7fb8b4edbcc10f2bcc92a0f387d7b2d8bb18f (patch) | |
tree | e68c7d78965f2852845dda045449e95e13cfc1cf /ext/xml | |
parent | 51ed05cc3d4e466c38ae9ddab27ce99ae164fafe (diff) | |
download | php-git-c9f7fb8b4edbcc10f2bcc92a0f387d7b2d8bb18f.tar.gz |
rename and WS fixes
Diffstat (limited to 'ext/xml')
-rw-r--r-- | ext/xml/tests/xml001.phpt (renamed from ext/xml/tests/001.phpt) | 47 | ||||
-rw-r--r-- | ext/xml/tests/xml002.phpt (renamed from ext/xml/tests/002.phpt) | 85 | ||||
-rw-r--r-- | ext/xml/tests/xml003.phpt (renamed from ext/xml/tests/003.phpt) | 81 | ||||
-rw-r--r-- | ext/xml/tests/xml004.phpt (renamed from ext/xml/tests/004.phpt) | 28 | ||||
-rw-r--r-- | ext/xml/tests/xml006.phpt (renamed from ext/xml/tests/006.phpt) | 2 | ||||
-rw-r--r-- | ext/xml/tests/xml007.phpt (renamed from ext/xml/tests/007.phpt) | 13 |
6 files changed, 132 insertions, 124 deletions
diff --git a/ext/xml/tests/001.phpt b/ext/xml/tests/xml001.phpt index 156be8cc66..ba241f3b09 100644 --- a/ext/xml/tests/001.phpt +++ b/ext/xml/tests/xml001.phpt @@ -19,60 +19,57 @@ if (!($fp = @fopen("xmltest.xml", "r"))) { } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); function startElement($parser, $name, $attribs) { - print "\{$name"; - if (sizeof($attribs)) { - while (list($k, $v) = each($attribs)) { - print " $k=\"$v\""; + print "\{$name"; + if (sizeof($attribs)) { + while (list($k, $v) = each($attribs)) { + print " $k=\"$v\""; + } } - } - print "}"; + print "}"; } function endElement($parser, $name) { - print "\{/$name}"; + print "\{/$name}"; } function characterData($parser, $data) { - print "\{CDATA[$data]}"; + print "\{CDATA[$data]}"; } function PIHandler($parser, $target, $data) { - print "\{PI[$target,$data]}"; + print "\{PI[$target,$data]}"; } function defaultHandler($parser, $data) { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print "\{ENTREF[$data]}"; - } else { - print "\{?[$data]}"; - } + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print "\{ENTREF[$data]}"; + } else { + print "\{?[$data]}"; + } } -function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, - $publicId) +function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) { - print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; - return true; + print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; + return true; } ?> ---GET-- ---POST-- --EXPECT-- {?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[ ]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[ diff --git a/ext/xml/tests/002.phpt b/ext/xml/tests/xml002.phpt index 3d1ac4cec9..11715eab66 100644 --- a/ext/xml/tests/002.phpt +++ b/ext/xml/tests/xml002.phpt @@ -10,63 +10,66 @@ $xml_parser = xml_parser_create(); $obj = new myclass; xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1); xml_set_element_handler($xml_parser, array($obj,"startElement"), - array($obj, "endElement")); +array($obj, "endElement")); xml_set_character_data_handler($xml_parser, array($obj, "characterData")); xml_set_processing_instruction_handler($xml_parser, array($obj, "PIHandler")); xml_set_default_handler($xml_parser, array($obj, "defaultHandler")); xml_set_external_entity_ref_handler($xml_parser, - array($obj, "externalEntityRefHandler")); - +array($obj, "externalEntityRefHandler")); + if (!($fp = @fopen("xmltest.xml", "r"))) { - die("could not open XML input"); + die("could not open XML input"); } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); -class myclass { - function startElement($parser, $name, $attribs) { - print "\{$name"; - if (sizeof($attribs)) { - while (list($k, $v) = each($attribs)) { - print " $k=\"$v\""; - } +class myclass +{ + function startElement($parser, $name, $attribs) + { + print "\{$name"; + if (sizeof($attribs)) { + while (list($k, $v) = each($attribs)) { + print " $k=\"$v\""; + } + } + print "}"; + } + function endElement($parser, $name) + { + print "\{/$name}"; + } + function characterData($parser, $data) + { + print "\{CDATA[$data]}"; } - print "}"; - } - function endElement($parser, $name) { - print "\{/$name}"; - } - function characterData($parser, $data) { - print "\{CDATA[$data]}"; - } - function PIHandler($parser, $target, $data) { - print "\{PI[$target,$data]}"; - } - function defaultHandler($parser, $data) { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print "\{ENTREF[$data]}"; - } else { - print "\{?[$data]}"; + function PIHandler($parser, $target, $data) + { + print "\{PI[$target,$data]}"; + } + function defaultHandler($parser, $data) + { + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print "\{ENTREF[$data]}"; + } else { + print "\{?[$data]}"; + } + } + function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) + { + print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; + return true; } - } - function externalEntityRefHandler($parser, $openEntityNames, $base, - $systemId, $publicId) { - print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; - return true; - } } - ?> ---GET-- ---POST-- --EXPECT-- {?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[ ]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[ diff --git a/ext/xml/tests/003.phpt b/ext/xml/tests/xml003.phpt index 9dab6b5ddc..ab9aa6254f 100644 --- a/ext/xml/tests/003.phpt +++ b/ext/xml/tests/xml003.phpt @@ -15,57 +15,60 @@ xml_set_character_data_handler($xml_parser, "characterData"); xml_set_processing_instruction_handler($xml_parser, "PIHandler"); xml_set_default_handler($xml_parser, "defaultHandler"); xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler"); - + if (!($fp = @fopen("xmltest.xml", "r"))) { - die("could not open XML input"); + die("could not open XML input"); } while ($data = fread($fp, 4096)) { - if (!xml_parse($xml_parser, $data, feof($fp))) { - die(sprintf("XML error: %s at line %d\n", - xml_error_string(xml_get_error_code($xml_parser)), - xml_get_current_line_number($xml_parser))); - } + if (!xml_parse($xml_parser, $data, feof($fp))) { + die(sprintf("XML error: %s at line %d\n", + xml_error_string(xml_get_error_code($xml_parser)), + xml_get_current_line_number($xml_parser))); + } } print "parse complete\n"; xml_parser_free($xml_parser); -class myclass { - function startElement($parser, $name, $attribs) { - print "\{$name"; - if (sizeof($attribs)) { - while (list($k, $v) = each($attribs)) { - print " $k=\"$v\""; - } +class myclass +{ + function startElement($parser, $name, $attribs) + { + print "\{$name"; + if (sizeof($attribs)) { + while (list($k, $v) = each($attribs)) { + print " $k=\"$v\""; + } + } + print "}"; + } + function endElement($parser, $name) + { + print "\{/$name}"; + } + function characterData($parser, $data) + { + print "\{CDATA[$data]}"; } - print "}"; - } - function endElement($parser, $name) { - print "\{/$name}"; - } - function characterData($parser, $data) { - print "\{CDATA[$data]}"; - } - function PIHandler($parser, $target, $data) { - print "\{PI[$target,$data]}"; - } - function defaultHandler($parser, $data) { - if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - print "\{ENTREF[$data]}"; - } else { - print "\{?[$data]}"; + function PIHandler($parser, $target, $data) + { + print "\{PI[$target,$data]}"; + } + function defaultHandler($parser, $data) + { + if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { + print "\{ENTREF[$data]}"; + } else { + print "\{?[$data]}"; + } + } + function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId, $publicId) + { + print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; + return true; } - } - function externalEntityRefHandler($parser, $openEntityNames, $base, - $systemId, $publicId) { - print "\{EXTENTREF[$openEntityNames,$base,$systemId,$publicId]}\n"; - return true; - } } - ?> ---GET-- ---POST-- --EXPECT-- {?[<?xml version="1.0" encoding="ISO-8859-1"?>]}{?[ ]}{?[<!DOCTYPE]}{?[ ]}{?[phptest]}{?[ ]}{?[SYSTEM]}{?[ ]}{?["notfound.dtd"]}{?[ ]}{?[[]}{?[ diff --git a/ext/xml/tests/004.phpt b/ext/xml/tests/xml004.phpt index 564c197939..245a93fc10 100644 --- a/ext/xml/tests/004.phpt +++ b/ext/xml/tests/xml004.phpt @@ -11,7 +11,7 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false); xml_set_element_handler($xp, "start_element", "end_element"); $fp = fopen("xmltest.xml", "r"); while ($data = fread($fp, 4096)) { - xml_parse($xp, $data, feof($fp)); + xml_parse($xp, $data, feof($fp)); } xml_parser_free($xp); $xp = xml_parser_create(); @@ -19,24 +19,26 @@ xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($xp, "start_element", "end_element"); $fp = fopen("xmltest.xml", "r"); while ($data = fread($fp, 4096)) { - xml_parse($xp, $data, feof($fp)); + xml_parse($xp, $data, feof($fp)); } xml_parser_free($xp); -function start_element($xp, $elem, $attribs) { - print "<$elem"; - if (sizeof($attribs)) { - while (list($k, $v) = each($attribs)) { - print " $k=\"$v\""; + +function start_element($xp, $elem, $attribs) +{ + print "<$elem"; + if (sizeof($attribs)) { + while (list($k, $v) = each($attribs)) { + print " $k=\"$v\""; + } } - } - print ">\n"; + print ">\n"; } -function end_element($xp, $elem) { - print "</$elem>\n"; + +function end_element($xp, $elem) +{ + print "</$elem>\n"; } ?> ---GET-- ---POST-- --EXPECT-- <root id="elem1"> <elem1> diff --git a/ext/xml/tests/006.phpt b/ext/xml/tests/xml006.phpt index a1b339f0e0..c714e85913 100644 --- a/ext/xml/tests/006.phpt +++ b/ext/xml/tests/xml006.phpt @@ -7,8 +7,6 @@ UTF-8<->ISO Latin 1 encoding/decoding test printf("%s -> %s\n", urlencode("æ"), urlencode(utf8_encode("æ"))); printf("%s <- %s\n", urlencode(utf8_decode(urldecode("%C3%A6"))), "%C3%A6"); ?> ---GET-- ---POST-- --EXPECT-- %E6 -> %C3%A6 %E6 <- %C3%A6 diff --git a/ext/xml/tests/007.phpt b/ext/xml/tests/xml007.phpt index c0863d8afe..994bbe473e 100644 --- a/ext/xml/tests/007.phpt +++ b/ext/xml/tests/xml007.phpt @@ -10,8 +10,15 @@ if(strtoupper("äöü") == "äöü") ?> --FILE-- <?php -function startHandler($parser,$tag,$attr) { var_dump($tag,$attr); } -function endHandler($parser,$tag) { var_dump($tag); } +function startHandler($parser,$tag,$attr) +{ + var_dump($tag,$attr); +} + +function endHandler($parser,$tag) +{ + var_dump($tag); +} $xmldata = '<?xml version="1.0" encoding="ISO-8859-1"?><äöü üäß="Üäß">ÄÖÜ</äöü>'; $parser = xml_parser_create('ISO-8859-1'); @@ -19,8 +26,6 @@ xml_set_element_handler($parser, "startHandler", "endHandler"); xml_parse_into_struct($parser, $xmldata, $struct, $index); var_dump($struct); ?> ---GET-- ---POST-- --EXPECT-- string(3) "ÄÖÜ" array(1) { |