From b0bc1fa835cc58c9b90fc7fe885c078481e68abb Mon Sep 17 00:00:00 2001 From: Egon Schmid Date: Sat, 25 Dec 1999 08:47:51 +0000 Subject: [PATCH] Enhanced a little bit. merry six-mas to all. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@17924 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/xml.xml | 76 ++++++++++++++++++++++++++++++----------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/functions/xml.xml b/functions/xml.xml index eaf57bfb32..a3a66eadb4 100644 --- a/functions/xml.xml +++ b/functions/xml.xml @@ -12,16 +12,15 @@ document interchange on the Web. It is a standard defined by The World Wide Web consortium (W3C). Information about XML and related technologies can be found at http://www.w3.org/XML/. + url="&url.xml;">&url.xml;. Installation This extension uses expat, which can - be found at http://www.jclark.com/xml/. - The Makefile that comes with expat does not build a library by + be found at &url.expat;. The + Makefile that comes with expat does not build a library by default, you can use this make rule for that: libexpat.a: $(OBJS) @@ -29,7 +28,7 @@ libexpat.a: $(OBJS) ranlib $@ A source RPM package of expat can be found at http://www.guardian.no/~ssb/phpxml.html. + url="&url.expat.rpm;">&url.expat.rpm;. Note that if you are using Apache-1.3.7 or later, you already @@ -53,6 +52,7 @@ libexpat.a: $(OBJS) Build PHP. Tada! That should be it. + About This Extension @@ -302,7 +302,6 @@ while ($data = fread($fp, 4096)) { } } xml_parser_free($xml_parser); - @@ -388,8 +387,9 @@ $file = "xmltest.xml"; function trustedFile($file) { // only trust local files owned by ourselves - if (!eregi("^([a-z]+)://", $file) && fileowner($file) == getmyuid()) { - return true; + if (!eregi("^([a-z]+)://", $file) + && fileowner($file) == getmyuid()) { + return true; } return false; } @@ -398,7 +398,8 @@ function startElement($parser, $name, $attribs) { print "&lt;<font color=\"#0000cc\">$name</font>"; if (sizeof($attribs)) { while (list($k, $v) = each($attribs)) { - print " <font color=\"#009900\">$k</font>=\"<font color=\"#990000\">$v</font>\""; + print " <font color=\"#009900\">$k</font>=\"<font + color=\"#990000\">$v</font>\""; } } print "&gt;"; @@ -422,7 +423,8 @@ function PIHandler($parser, $target, $data) { if (trustedFile($parser_file[$parser])) { eval($data); } else { - printf("Untrusted PHP code: <i>%s</i>", htmlspecialchars($data)); + printf("Untrusted PHP code: <i>%s</i>", + htmlspecialchars($data)); } break; } @@ -430,9 +432,11 @@ function PIHandler($parser, $target, $data) { function defaultHandler($parser, $data) { if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); + printf('<font color="#aa00aa">%s</font>', + htmlspecialchars($data)); } else { - printf('<font size="-1">%s</font>', htmlspecialchars($data)); + printf('<font size="-1">%s</font>', + htmlspecialchars($data)); } } @@ -573,14 +577,16 @@ xml_parser_free($xml_parser); encoding (optional) - + + Which character encoding the parser should use. The following character encodings are supported: ISO-8859-1 (default) US-ASCII UTF-8 - + + @@ -680,7 +686,8 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); endElementHandler are strings containing the names of functions that must exist when xml_parse is called for - parser. + parser. + The function named by startElementHandler must accept three parameters: @@ -692,10 +699,14 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); - parser - The first parameter, parser, is a - reference to the XML parser calling the - handler. + parser + + + The first parameter, parser, is a + reference to the XML parser calling the + handler. + + name @@ -1019,7 +1030,8 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); external entity declaration with an NDATA declaration, like the following: -<!ENTITY name {publicId | systemId} NDATA notationName> +<!ENTITY name {publicId | systemId} + NDATA notationName> @@ -1063,7 +1075,9 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); This is the base for resolving the system identifier (systemId) of the external entity. Currently this parameter will always be set to - an empty string. + an empty string. + + systemId @@ -1236,7 +1250,8 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); parser. handler is a string containing the name of a function that must exist when xml_parse is called for - parser. + parser. + The function named by handler must accept five parameters, and should return an integer value. If the @@ -1244,7 +1259,7 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); value is returned), the XML parser will stop parsing and xml_get_error_code will return XML_ERROR_EXTERNAL_ENTITY_HANDLING. - + int handler int parser string @@ -1345,7 +1360,8 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); parser - A reference to the XML parser to use. + A reference to the XML parser to use. + @@ -1373,7 +1389,8 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); When the XML document is parsed, the handlers for the configured events are called as many times as necessary, after which this - function returns true or false. + function returns true or false. + True is returned if the parse was successful, false if it was not successful, or if parser does not refer to @@ -1567,8 +1584,11 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</A>"); parser - - A reference to the XML parser to free. + + + A reference to the XML parser to free. + + @@ -1815,7 +1835,7 @@ sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil -sgml-default-dtd-file:"../manual.ced" +sgml-default-dtd-file:"../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil