cvs: phpdoc /it/chapters install.xml /it/functions xml.xml
| From: | Luca Perugini | Date: | Thu, 02 Nov 2000 08:26:45 +0000 |
| Subject: | cvs: phpdoc /it/chapters install.xml /it/functions xml.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969332767@lists.php.net to get a copy of this message | ||
perugini Thu Nov 2 00:26:45 2000 EDT
Modified files:
/phpdoc/it/functions xml.xml
/phpdoc/it/chapters install.xml
Log:
Updated with en tree
Index: phpdoc/it/functions/xml.xml diff -u phpdoc/it/functions/xml.xml:1.4 phpdoc/it/functions/xml.xml:1.5 --- phpdoc/it/functions/xml.xml:1.4 Tue Jul 11 17:05:34 2000 +++ phpdoc/it/functions/xml.xml Thu Nov 2 00:26:44 2000 @@ -24,8 +24,8 @@ default, you can use this make rule for that: <programlisting role="makefile"> libexpat.a: $(OBJS) - ar -rc $@ $(OBJS) - ranlib $@ + ar -rc $@ $(OBJS) + ranlib $@ </programlisting> A source RPM package of expat can be found at <ulink url="&url.expat.rpm;">&url.expat.rpm;</ulink>. @@ -77,84 +77,84 @@ <table> <title>Supported XML handlers</title> <tgroup cols="2"> - <thead> - <row> - <entry>PHP function to set handler</entry> - <entry>Event description</entry> - </row> - </thead> - <tbody> - <row> - <entry><function>xml_set_element_handler</function></entry> - <entry> - Element events are issued whenever the XML parser - encounters start or end tags. There are separate handlers - for start tags and end tags. - </entry> - </row> - <row> - <entry> - <function>xml_set_character_data_handler</function> - </entry> - <entry> - Character data is roughly all the non-markup contents of - XML documents, including whitespace between tags. Note - that the XML parser does not add or remove any whitespace, - it is up to the application (you) to decide whether - whitespace is significant. - </entry> - </row> - <row> - <entry> - <function>xml_set_processing_instruction_handler</function> - </entry> - <entry> - PHP programmers should be familiar with processing - instructions (PIs) already. <?php ?> is a processing - instruction, where <replaceable>php</replaceable> is called - the "PI target". The handling of these are - application-specific, except that all PI targets starting - with "XML" are reserved. - </entry> - </row> - <row> - <entry><function>xml_set_default_handler</function></entry> - <entry> - What goes not to another handler goes to the default - handler. You will get things like the XML and document - type declarations in the default handler. - </entry> - </row> - <row> - <entry> - <function>xml_set_unparsed_entity_decl_handler</function> - </entry> - <entry> - This handler will be called for declaration of an unparsed - (NDATA) entity. - </entry> - </row> - <row> - <entry> - <function>xml_set_notation_decl_handler</function> - </entry> - <entry> - This handler is called for declaration of a notation. - </entry> - </row> - <row> - <entry> - <function>xml_set_external_entity_ref_handler</function> - </entry> - <entry> - This handler is called when the XML parser finds a - reference to an external parsed general entity. This can - be a reference to a file or URL, for example. See <link - linkend="example.xml-external-entity">the external entity - example</link> for a demonstration. - </entry> - </row> - </tbody> + <thead> + <row> + <entry>PHP function to set handler</entry> + <entry>Event description</entry> + </row> + </thead> + <tbody> + <row> + <entry><function>xml_set_element_handler</function></entry> + <entry> + Element events are issued whenever the XML parser + encounters start or end tags. There are separate handlers + for start tags and end tags. + </entry> + </row> + <row> + <entry> + <function>xml_set_character_data_handler</function> + </entry> + <entry> + Character data is roughly all the non-markup contents of + XML documents, including whitespace between tags. Note + that the XML parser does not add or remove any whitespace, + it is up to the application (you) to decide whether + whitespace is significant. + </entry> + </row> + <row> + <entry> + <function>xml_set_processing_instruction_handler</function> + </entry> + <entry> + PHP programmers should be familiar with processing + instructions (PIs) already. <?php ?> is a processing + instruction, where <replaceable>php</replaceable> is called + the "PI target". The handling of these are + application-specific, except that all PI targets starting + with "XML" are reserved. + </entry> + </row> + <row> + <entry><function>xml_set_default_handler</function></entry> + <entry> + What goes not to another handler goes to the default + handler. You will get things like the XML and document + type declarations in the default handler. + </entry> + </row> + <row> + <entry> + <function>xml_set_unparsed_entity_decl_handler</function> + </entry> + <entry> + This handler will be called for declaration of an unparsed + (NDATA) entity. + </entry> + </row> + <row> + <entry> + <function>xml_set_notation_decl_handler</function> + </entry> + <entry> + This handler is called for declaration of a notation. + </entry> + </row> + <row> + <entry> + <function>xml_set_external_entity_ref_handler</function> + </entry> + <entry> + This handler is called when the XML parser finds a + reference to an external parsed general entity. This can + be a reference to a file or URL, for example. See <link + linkend="example.xml-external-entity">the external entity + example</link> for a demonstration. + </entry> + </row> + </tbody> </tgroup> </table> </para> @@ -313,29 +313,29 @@ <example> <title>Map XML to HTML</title> <para> - This example maps tags in an XML document directly to HTML - tags. Elements not found in the "map array" are ignored. Of - course, this example will only work with a specific XML - document type. - <programlisting role="php"> + This example maps tags in an XML document directly to HTML + tags. Elements not found in the "map array" are ignored. Of + course, this example will only work with a specific XML + document type. + <programlisting role="php"> $file = "data.xml"; $map_array = array( - "BOLD" => "B", - "EMPHASIS" => "I", - "LITERAL" => "TT" + "BOLD" => "B", + "EMPHASIS" => "I", + "LITERAL" => "TT" ); function startElement($parser, $name, $attrs) { global $map_array; if ($htmltag = $map_array[$name]) { - print "<$htmltag>"; + print "<$htmltag>"; } } function endElement($parser, $name) { global $map_array; if ($htmltag = $map_array[$name]) { - print "</$htmltag>"; + print "</$htmltag>"; } } @@ -360,7 +360,7 @@ } } xml_parser_free($xml_parser); - </programlisting> + </programlisting> </para> </example> </para> @@ -501,7 +501,7 @@ print "parse complete\n"; xml_parser_free($xml_parser); -?> +?> </programlisting> </example> </para> @@ -509,33 +509,33 @@ <example> <title>xmltest.xml</title> <programlisting role="xml"> -<?xml version='1.0'?> +<?xml version='1.0'?> <!DOCTYPE chapter SYSTEM "/just/a/test.dtd" [ -<!ENTITY plainEntity "FOO entity"> -<!ENTITY systemEntity SYSTEM "xmltest2.xml"> -]> -<chapter> - <TITLE>Title &plainEntity;</TITLE> - <para> - <informaltable> - <tgroup cols="3"> - <tbody> - <row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> - <row><entry>a2</entry><entry>c2</entry></row> - <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> - </tbody> - </tgroup> - </informaltable> - </para> +<!ENTITY plainEntity "FOO entity"> +<!ENTITY systemEntity SYSTEM "xmltest2.xml"> +]> +<chapter> + <TITLE>Title &plainEntity;</TITLE> + <para> + <informaltable> + <tgroup cols="3"> + <tbody> + <row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> + <row><entry>a2</entry><entry>c2</entry></row> + <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> + </tbody> + </tgroup> + </informaltable> + </para> &systemEntity; - <sect1 id="about"> - <title>About this Document</title> - <para> - <!-- this is a comment --> - <?php print 'Hi! This is PHP version '.phpversion(); ?> - </para> - </sect1> -</chapter> + <sect1 id="about"> + <title>About this Document</title> + <para> + <!-- this is a comment --> + <?php print 'Hi! This is PHP version '.phpversion(); ?> + </para> + </sect1> +</chapter> </programlisting> </example> </para> @@ -544,15 +544,15 @@ <example> <title>xmltest2.xml</title> <programlisting role="xml"> -<?xml version="1.0"?> +<?xml version="1.0"?> <!DOCTYPE foo [ -<!ENTITY testEnt "test entity"> -]> -<foo> - <element attrib="value"/> +<!ENTITY testEnt "test entity"> +]> +<foo> + <element attrib="value"/> &testEnt; - <?php print "This is some more PHP code being executed."; ?> -</foo> + <?php print "This is some more PHP code being executed."; ?> +</foo> </programlisting> </example> </para> @@ -580,15 +580,15 @@ <varlistentry> <term><parameter>encoding</parameter> (optional)</term> <listitem> - <para> - Which character encoding the parser should use. The - following character encodings are supported: - <simplelist> - <member><literal>ISO-8859-1</literal> (default)</member> - <member><literal>US-ASCII</literal></member> - <member><literal>UTF-8</literal></member> - </simplelist> - </para> + <para> + Which character encoding the parser should use. The + following character encodings are supported: + <simplelist> + <member><literal>ISO-8859-1</literal> (default)</member> + <member><literal>US-ASCII</literal></member> + <member><literal>UTF-8</literal></member> + </simplelist> + </para> </listitem> </varlistentry> </variablelist> @@ -602,7 +602,7 @@ <refentry id="function.xml-set-object"> <refnamediv> <refname>xml_set_object</refname> - <refpurpose>Use XML Parser withing an object</refpurpose> + <refpurpose>Use XML Parser within an object</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -614,9 +614,9 @@ </funcprototype> </funcsynopsis> <para> - This function makes <parameter>parser</parameter> useable from - within <parameter>object</parameter>. All callback functions - settet via <function>xml_set_element_handler</function> etc are + This function allows to use <parameter>parser</parameter> inside + <parameter>object</parameter>. All callback functions could be + set with <function>xml_set_element_handler</function> etc and assumed to be methods of <parameter>object</parameter>. </para> <programlisting role="php"> @@ -625,14 +625,14 @@ var $parser; function xml() { - $this->parser = xml_parser_create(); - xml_set_object($this->parser,&$this); - xml_set_element_handler($this->parser,"tag_open","tag_close"); - xml_set_character_data_handler($this->parser,"cdata"); + $this->parser = xml_parser_create(); + xml_set_object($this->parser,&$this); + xml_set_element_handler($this->parser,"tag_open","tag_close"); + xml_set_character_data_handler($this->parser,"cdata"); } function parse($data) { - xml_parse($this->parser,$data); + xml_parse($this->parser,$data); } function tag_open($parser,$tag,$attributes) { @@ -650,17 +650,9 @@ } // end of class xml $xml_parser = new xml(); -$xml_parser->parse("<A ID=\"hallo\">PHP</A>"); -?> - </programlisting> - <para> - <note> - <para> - <function>xml_set_object</function> handling was added in PHP - 4.0. - </para> - </note> - </para> +$xml_parser->parse("<A ID=\"hallo\">PHP</A>"); +?> + </programlisting> </refsect1> </refentry> @@ -709,43 +701,43 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>name</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>name</parameter>, contains - the name of the element for which this handler is called. If - <link linkend="xml.case-folding">case-folding</link> is in - effect for this parser, the element name will be in uppercase - letters. - </simpara> + <simpara> + The second parameter, <parameter>name</parameter>, contains + the name of the element for which this handler is called. If + <link linkend="xml.case-folding">case-folding</link> is in + effect for this parser, the element name will be in uppercase + letters. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>attribs</parameter></term> <listitem> - <simpara> - The third parameter, <parameter>attribs</parameter>, contains - an associative array with the element's attributes (if any). - The keys of this array are the attribute names, the values - are the attribute values. Attribute names are <link - linkend="xml.case-folding">case-folded</link> on the same - criteria as element names. Attribute values are - <emphasis>not</emphasis> case-folded. - </simpara> - <simpara> - The original order of the attributes can be retrieved by - walking through <parameter>attribs</parameter> the normal - way, using <function>each</function>. The first key in the - array was the first attribute, and so on. - </simpara> + <simpara> + The third parameter, <parameter>attribs</parameter>, contains + an associative array with the element's attributes (if any). + The keys of this array are the attribute names, the values + are the attribute values. Attribute names are <link + linkend="xml.case-folding">case-folded</link> on the same + criteria as element names. Attribute values are + <emphasis>not</emphasis> case-folded. + </simpara> + <simpara> + The original order of the attributes can be retrieved by + walking through <parameter>attribs</parameter> the normal + way, using <function>each</function>. The first key in the + array was the first attribute, and so on. + </simpara> </listitem> </varlistentry> </variablelist> @@ -764,23 +756,23 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>name</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>name</parameter>, contains - the name of the element for which this handler is called. If - <link linkend="xml.case-folding">case-folding</link> is in - effect for this parser, the element name will be in uppercase - letters. - </simpara> + <simpara> + The second parameter, <parameter>name</parameter>, contains + the name of the element for which this handler is called. If + <link linkend="xml.case-folding">case-folding</link> is in + effect for this parser, the element name will be in uppercase + letters. + </simpara> </listitem> </varlistentry> </variablelist> @@ -794,7 +786,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -835,19 +829,19 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>data</parameter>, contains - the character data as a string. - </simpara> + <simpara> + The second parameter, <parameter>data</parameter>, contains + the character data as a string. + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -861,7 +855,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -927,14 +923,14 @@ <varlistentry> <term><parameter>target</parameter></term> <listitem><simpara> - The second parameter, <parameter>target</parameter>, contains - the PI target.</simpara></listitem> + The second parameter, <parameter>target</parameter>, contains + the PI target.</simpara></listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem><simpara> - The third parameter, <parameter>data</parameter>, contains - the PI data.</simpara></listitem> + The third parameter, <parameter>data</parameter>, contains + the PI data.</simpara></listitem> </varlistentry> </variablelist></para> <para> @@ -946,7 +942,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -986,27 +984,27 @@ <variablelist> <varlistentry> <term> - <parameter>parser</parameter> + <parameter>parser</parameter> </term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>data</parameter> + <parameter>data</parameter> </term> <listitem> - <simpara> - The second parameter, <parameter>data</parameter>, contains - the character data. This may be the XML declaration, - document type declaration, entities or other data for which - no other handler exists. - </simpara> + <simpara> + The second parameter, <parameter>data</parameter>, contains + the character data. This may be the XML declaration, + document type declaration, entities or other data for which + no other handler exists. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1020,7 +1018,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1080,54 +1080,54 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>entityName</parameter></term> <listitem> - <simpara> - The name of the entity that is about to be defined. - </simpara> + <simpara> + The name of the entity that is about to be defined. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>base</parameter></term> <listitem><simpara> - This is the base for resolving the system identifier - (<parameter>systemId</parameter>) of the external - entity. Currently this parameter will always be set to - an empty string. - </simpara> + This is the base for resolving the system identifier + (<parameter>systemId</parameter>) of the external + entity. Currently this parameter will always be set to + an empty string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - System identifier for the external entity. - </simpara> + <simpara> + System identifier for the external entity. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>publicId</parameter></term> <listitem> - <simpara> - Public identifier for the external entity. - </simpara> + <simpara> + Public identifier for the external entity. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>notationName</parameter></term> <listitem> - <simpara> - Name of the notation of this entity (see - <function>xml_set_notation_decl_handler</function>). - </simpara> + <simpara> + Name of the notation of this entity (see + <function>xml_set_notation_decl_handler</function>). + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -1140,7 +1140,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1192,56 +1194,56 @@ <variablelist> <varlistentry> <term> - <parameter>parser</parameter> + <parameter>parser</parameter> </term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>notationName</parameter></term> <listitem> - <simpara> - This is the notation's <parameter>name</parameter>, as per - the notation format described above. - </simpara> + <simpara> + This is the notation's <parameter>name</parameter>, as per + the notation format described above. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>base</parameter> + <parameter>base</parameter> </term> <listitem> - <simpara> - This is the base for resolving the system identifier - (<parameter>systemId</parameter>) of the notation - declaration. Currently this parameter will always be set to - an empty string. - </simpara> + <simpara> + This is the base for resolving the system identifier + (<parameter>systemId</parameter>) of the notation + declaration. Currently this parameter will always be set to + an empty string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - System identifier of the external notation - declaration. - </simpara> + <simpara> + System identifier of the external notation + declaration. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>publicId</parameter> + <parameter>publicId</parameter> </term> <listitem> - <simpara> - Public identifier of the external notation - declaration. - </simpara> + <simpara> + Public identifier of the external notation + declaration. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1256,7 +1258,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1307,53 +1311,53 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>openEntityNames</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>openEntityNames</parameter>, - is a space-separated list of the names of the entities that - are open for the parse of this entity (including the name of - the referenced entity). - </simpara> + <simpara> + The second parameter, <parameter>openEntityNames</parameter>, + is a space-separated list of the names of the entities that + are open for the parse of this entity (including the name of + the referenced entity). + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>base</parameter></term> <listitem> - <simpara> - This is the base for resolving the system identifier - (<parameter>systemid</parameter>) of the external entity. - Currently this parameter will always be set to an empty - string. - </simpara> + <simpara> + This is the base for resolving the system identifier + (<parameter>systemid</parameter>) of the external entity. + Currently this parameter will always be set to an empty + string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - The fourth parameter, <parameter>systemId</parameter>, is the - system identifier as specified in the entity declaration. - </simpara> + <simpara> + The fourth parameter, <parameter>systemId</parameter>, is the + system identifier as specified in the entity declaration. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>publicId</parameter></term> <listitem> - <simpara> - The fifth parameter, <parameter>publicId</parameter>, is the - public identifier as specified in the entity declaration, or - an empty string if none was specified; the whitespace in the - public identifier will have been normalized as required by - the XML spec. - </simpara> + <simpara> + The fifth parameter, <parameter>publicId</parameter>, is the + public identifier as specified in the entity declaration, or + an empty string if none was specified; the whitespace in the + public identifier will have been normalized as required by + the XML spec. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1368,7 +1372,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1395,29 +1401,29 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to use. - </simpara> + <simpara> + A reference to the XML parser to use. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem> - <simpara> - Chunk of data to parse. A document may be parsed piece-wise - by calling <function>xml_parse</function> several times with - new data, as long as the <parameter>isFinal</parameter> - parameter is set and true when the last data is parsed. - </simpara> + <simpara> + Chunk of data to parse. A document may be parsed piece-wise + by calling <function>xml_parse</function> several times with + new data, as long as the <parameter>isFinal</parameter> + parameter is set and true when the last data is parsed. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>isFinal</parameter> (optional)</term> <listitem> - <simpara> - If set and true, <parameter>data</parameter> is the last - piece of data sent in this parse. - </simpara> + <simpara> + If set and true, <parameter>data</parameter> is the last + piece of data sent in this parse. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1458,9 +1464,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get error code from. - </simpara> + <simpara> + A reference to the XML parser to get error code from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1492,9 +1498,9 @@ <varlistentry> <term><parameter>code</parameter></term> <listitem> - <simpara> - An error code from <function>xml_get_error_code</function>. - </simpara> + <simpara> + An error code from <function>xml_get_error_code</function>. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1526,9 +1532,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get line number from. - </simpara> + <simpara> + A reference to the XML parser to get line number from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1563,9 +1569,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get column number from. - </simpara> + <simpara> + A reference to the XML parser to get column number from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1600,9 +1606,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get byte index from. - </simpara> + <simpara> + A reference to the XML parser to get byte index from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1615,6 +1621,220 @@ </refsect1> </refentry> + <refentry id="function.xml-parse-into-struct"> + <refnamediv> + <refname>xml_parse_into_struct</refname> + <refpurpose>Parse XML data into an array structure</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>xml_parse_into_struct</function></funcdef> + <paramdef>int <parameter>parser</parameter></paramdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>array <parameter>&values</parameter></paramdef> + <paramdef>array <parameter>&index</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function parses an XML file into 2 parallel array + structures, one (<parameter>index</parameter>) containing pointers + to the location of the appropriate values in the + <parameter>values</parameter> array. These last two parameters + must be passed by reference. + </para> + <para> + Below is an example that illustrates the internal structure of + the arrays being generated by the function. We use a simple + <literal>note</literal> tag embeded inside a + <literal>para</literal> tag, and then we parse this an print out + the structures generated: + <informalexample> + <programlisting> +$simple = "<para><note>simple note</note></para>"; +$p = xml_parser_create(); +xml_parse_into_struct($p,$simple,&$vals,&$index); +xml_parser_free($p); +echo "Index array\n"; +print_r($index); +echo "\nVals array\n"; +print_r($vals); + </programlisting> + </informalexample> + When we run that code, the output will be: + <informalexample> + <programlisting> +Index array +Array +( + [PARA] => Array + ( + [0] => 0 + [1] => 2 + ) + + [NOTE] => Array + ( + [0] => 1 + ) + +) + +Vals array +Array +( + [0] => Array + ( + [tag] => PARA + [type] => open + [level] => 1 + ) + + [1] => Array + ( + [tag] => NOTE + [type] => complete + [level] => 2 + [value] => simple note + ) + + [2] => Array + ( + [tag] => PARA + [type] => close + [level] => 1 + ) + +) + </programlisting> + </informalexample> + </para> + <para> + Event-driven parsing (based on the expat library) can get + complicated when you have an XML document that is complex. + This function does not produce a DOM style object, but it + generates structures amenable of being transversed in a tree + fashion. Thus, we can create objects representing the data + in the XML file easily. Let's consider the following XML file + representing a small database of aminoacids information: + <example> + <title>moldb.xml - small database of molecular information</title> + <programlisting> +<?xml version="1.0"?> +<moldb> + + <molecule> + <name>Alanine</name> + <symbol>ala</symbol> + <code>A</code> + <type>hydrophobic</type> + </molecule> + + <molecule> + <name>Lysine</name> + <symbol>lys</symbol> + <code>K</code> + <type>charged</type> + </molecule> + +</moldb> + </programlisting> + </example> + And some code to parse the document and generate the appropriate + objects: + <example> + <title> + parsemoldb.php - parses moldb.xml into and array of + molecular objects + </title> + <programlisting role="php"> +<?php + +class AminoAcid { + var $name; // aa name + var $symbol; // three letter symbol + var $code; // one letter code + var $type; // hydrophobic, charged or neutral + + function AminoAcid ($aa) { + foreach ($aa as $k=>$v) + $this->$k = $aa[$k]; + } +} + +function readDatabase($filename) { + // read the xml database of aminoacids + $data = implode("",file($filename)); + $parser = xml_parser_create(); + xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); + xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1); + xml_parse_into_struct($parser,$data,&$values,&$tags); + xml_parser_free($parser); + + // loop through the structures + foreach ($tags as $key=>$val) { + if ($key == "molecule") { + $molranges = $val; + // each contiguous pair of array entries are the + // lower and upper range for each molecule definition + for ($i=0; $i < count($molranges); $i+=2) { + $offset = $molranges[$i] + 1; + $len = $molranges[$i + 1] - $offset; + $tdb[] = parseMol(array_slice($values, $offset, $len)); + } + } else { + continue; + } + } + return $tdb; +} + +function parseMol($mvalues) { + for ($i=0; $i < count($mvalues); $i++) + $mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"]; + return new AminoAcid($mol); +} + +$db = readDatabase("moldb.xml"); +echo "** Database of AminoAcid objects:\n"; +print_r($db); + +?> + </programlisting> + </example> + After executing <filename>parsemoldb.php</filename>, the variable + <varname>$db</varname> contains an array of + <classname>AminoAcid</classname> objects, and the output of the + script confirms that: + <informalexample> + <programlisting> +** Database of AminoAcid objects: +Array +( + [0] => aminoacid Object + ( + [name] => Alanine + [symbol] => ala + [code] => A + [type] => hydrophobic + ) + + [1] => aminoacid Object + ( + [name] => Lysine + [symbol] => lys + [code] => K + [type] => charged + ) + +) + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + <refentry id="function.xml-parser-free"> <refnamediv> <refname>xml_parser_free</refname> @@ -1633,9 +1853,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to free. - </simpara> + <simpara> + A reference to the XML parser to free. + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -1667,25 +1887,25 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to set an option in. - </simpara> + <simpara> + A reference to the XML parser to set an option in. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>option</parameter></term> <listitem> - <simpara> - Which option to set. See below. - </simpara> + <simpara> + Which option to set. See below. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>value</parameter></term> <listitem> - <simpara> - The option's new value. - </simpara> + <simpara> + The option's new value. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1701,34 +1921,34 @@ <title>XML parser options</title> <tgroup cols="3"> <thead> - <row> - <entry>Option constant</entry> - <entry>Data type</entry> - <entry>Description</entry> - </row> + <row> + <entry>Option constant</entry> + <entry>Data type</entry> + <entry>Description</entry> + </row> </thead> <tbody> - <row> - <entry>XML_OPTION_CASE_FOLDING</entry> - <entry>integer</entry> - <entry> - Controls whether <link - linkend="xml.case-folding">case-folding</link> is enabled - for this XML parser. Enabled by default. - </entry> - </row> - <row> - <entry>XML_OPTION_TARGET_ENCODING</entry> - <entry>string</entry> - <entry> - Sets which <link linkend="xml.encoding">target - encoding</link> to use in this XML parser. By default, it - is set to the same as the source encoding used by - <function>xml_parser_create</function>. Supported target - encodings are <literal>ISO-8859-1</literal>, - <literal>US-ASCII</literal> and <literal>UTF-8</literal>. - </entry> - </row> + <row> + <entry>XML_OPTION_CASE_FOLDING</entry> + <entry>integer</entry> + <entry> + Controls whether <link + linkend="xml.case-folding">case-folding</link> is enabled + for this XML parser. Enabled by default. + </entry> + </row> + <row> + <entry>XML_OPTION_TARGET_ENCODING</entry> + <entry>string</entry> + <entry> + Sets which <link linkend="xml.encoding">target + encoding</link> to use in this XML parser. By default, it + is set to the same as the source encoding used by + <function>xml_parser_create</function>. Supported target + encodings are <literal>ISO-8859-1</literal>, + <literal>US-ASCII</literal> and <literal>UTF-8</literal>. + </entry> + </row> </tbody> </tgroup> </table> @@ -1757,20 +1977,20 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get an option - from. - </simpara> + <simpara> + A reference to the XML parser to get an option + from. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>option</parameter></term> <listitem> - <simpara> - Which option to fetch. See - <function>xml_parser_set_option</function> for a list of - options. - </simpara> + <simpara> + Which option to fetch. See + <function>xml_parser_set_option</function> for a list of + options. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1844,33 +2064,33 @@ <title>UTF-8 encoding</title> <tgroup cols="3"> <thead> - <row> - <entry>bytes</entry> - <entry>bits</entry> - <entry>representation</entry> - </row> + <row> + <entry>bytes</entry> + <entry>bits</entry> + <entry>representation</entry> + </row> </thead> <tbody> - <row> - <entry>1</entry> - <entry>7</entry> - <entry>0bbbbbbb</entry> - </row> - <row> - <entry>2</entry> - <entry>11</entry> - <entry>110bbbbb 10bbbbbb</entry> - </row> - <row> - <entry>3</entry> - <entry>16</entry> - <entry>1110bbbb 10bbbbbb 10bbbbbb</entry> - </row> - <row> - <entry>4</entry> - <entry>21</entry> - <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry> - </row> + <row> + <entry>1</entry> + <entry>7</entry> + <entry>0bbbbbbb</entry> + </row> + <row> + <entry>2</entry> + <entry>11</entry> + <entry>110bbbbb 10bbbbbb</entry> + </row> + <row> + <entry>3</entry> + <entry>16</entry> + <entry>1110bbbb 10bbbbbb 10bbbbbb</entry> + </row> + <row> + <entry>4</entry> + <entry>21</entry> + <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry> + </row> </tbody> </tgroup> </table> Index: phpdoc/it/chapters/install.xml diff -u phpdoc/it/chapters/install.xml:1.8 phpdoc/it/chapters/install.xml:1.9 --- phpdoc/it/chapters/install.xml:1.8 Wed Oct 11 06:39:22 2000 +++ phpdoc/it/chapters/install.xml Thu Nov 2 00:26:44 2000 @@ -272,7 +272,7 @@ </para> </sect2> - <sect2> + <sect2 id="install.building"> <title>Building</title> <simpara> When PHP is configured, you are ready to build the CGI executable @@ -282,7 +282,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.testing"> <title>Testing</title> <simpara> If you have built PHP as a CGI program, you may test your build @@ -292,7 +292,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.benchmarking"> <title>Benchmarking</title> <simpara> If you have built PHP as a CGI program, you may benchmark your @@ -1667,8 +1667,8 @@ <filename>/usr/local/lib</filename> </para> <para> - PHP 4: Sets the path in which to look for php.ini. Defaults to - <filename>/usr/local/lib</filename> + PHP 4: Sets the path in which to look for <filename>php.ini</filename>. + Defaults to <filename>/usr/local/lib</filename> </para> </listitem> </varlistentry> @@ -2121,6 +2121,14 @@ PHP 3, PHP 4: Disable the URL-aware fopen wrapper that allows accessing files via http or ftp. </para> + <warning> + <para> + This switch is only available for PHP versions up to 4.0.3, newer + versions provide an INI parameter called + <parameter>allow_url_fopen</parameter> instead of forcing you to + decide upon this feature at compile time. + </para> + </warning> </listitem> </varlistentry> @@ -2657,7 +2665,7 @@ </itemizedlist> </para> - <sect2> + <sect2 id="install.windows.general"> <title>General Installation Steps</title> <para> @@ -2736,7 +2744,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.iis3"> <title>Windows 95/98/NT and PWS/IIS 3</title> <simpara> @@ -2885,7 +2893,7 @@ </sect2> - <sect2> + <sect2 id="install.windowsnt.iis4"> <title>Windows NT and IIS 4</title> <simpara> @@ -2944,7 +2952,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.apache"> <title>Windows 9x/NT and Apache 1.3.x</title> <simpara> @@ -3005,7 +3013,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.omnihttpd"> <title>Omni HTTPd 2.0b1 for Windows</title> <simpara> @@ -3057,7 +3065,42 @@ </sect2> - <sect2> + <sect2 id="install.windows.installer"> + <title>Windows Installshield</title> + + <para> + The Windows PHP installer available from the downloads page at + <ulink url="&url.php;">&url.php;</ulink> installs the CGI version of + PHP and, for IIS, PWS, and Xitami, configures the web server as well. + </para> + + <simpara> + Install your choosen http server on your system and make sure it all works. + </simpara> + + <simpara> + Run the installer exe file and follow the instructions provided by the + installation wizard. Two types of installation are supported - standard, + which provides sensible defaults for all the settings it can, and + advanced, which asks questions as it goes along. + </simpara> + + <simpara> + The installation wizard gathers enough information to set up the + <filename>php.ini</filename> file and configure the web server to use PHP. + For IIS and also PWS on NT Workstation, a list of all the nodes on the server + with script map settings is displayed, and you can choose those nodes to which + you wish to add the PHP script mappings. + </simpara> + + <simpara> + Once the installation has completed the installer will inform you if you + need to restart your system, restart the server, or just start using PHP. + </simpara> + + </sect2> + + <sect2 id="install.windows.modules"> <title>PHP Modules</title> <para> @@ -3154,7 +3197,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.bugreports"> <title>Bug reports</title> <simpara> If you think you have found a bug in PHP, please report it. The @@ -3165,7 +3208,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.otherproblems"> <title>Other problems</title> <simpara>
Index: phpdoc/it/functions/xml.xml diff -u phpdoc/it/functions/xml.xml:1.4 phpdoc/it/functions/xml.xml:1.5 --- phpdoc/it/functions/xml.xml:1.4 Tue Jul 11 17:05:34 2000 +++ phpdoc/it/functions/xml.xml Thu Nov 2 00:26:44 2000 @@ -24,8 +24,8 @@ default, you can use this make rule for that: <programlisting role="makefile"> libexpat.a: $(OBJS) - ar -rc $@ $(OBJS) - ranlib $@ + ar -rc $@ $(OBJS) + ranlib $@ </programlisting> A source RPM package of expat can be found at <ulink url="&url.expat.rpm;">&url.expat.rpm;</ulink>. @@ -77,84 +77,84 @@ <table> <title>Supported XML handlers</title> <tgroup cols="2"> - <thead> - <row> - <entry>PHP function to set handler</entry> - <entry>Event description</entry> - </row> - </thead> - <tbody> - <row> - <entry><function>xml_set_element_handler</function></entry> - <entry> - Element events are issued whenever the XML parser - encounters start or end tags. There are separate handlers - for start tags and end tags. - </entry> - </row> - <row> - <entry> - <function>xml_set_character_data_handler</function> - </entry> - <entry> - Character data is roughly all the non-markup contents of - XML documents, including whitespace between tags. Note - that the XML parser does not add or remove any whitespace, - it is up to the application (you) to decide whether - whitespace is significant. - </entry> - </row> - <row> - <entry> - <function>xml_set_processing_instruction_handler</function> - </entry> - <entry> - PHP programmers should be familiar with processing - instructions (PIs) already. <?php ?> is a processing - instruction, where <replaceable>php</replaceable> is called - the "PI target". The handling of these are - application-specific, except that all PI targets starting - with "XML" are reserved. - </entry> - </row> - <row> - <entry><function>xml_set_default_handler</function></entry> - <entry> - What goes not to another handler goes to the default - handler. You will get things like the XML and document - type declarations in the default handler. - </entry> - </row> - <row> - <entry> - <function>xml_set_unparsed_entity_decl_handler</function> - </entry> - <entry> - This handler will be called for declaration of an unparsed - (NDATA) entity. - </entry> - </row> - <row> - <entry> - <function>xml_set_notation_decl_handler</function> - </entry> - <entry> - This handler is called for declaration of a notation. - </entry> - </row> - <row> - <entry> - <function>xml_set_external_entity_ref_handler</function> - </entry> - <entry> - This handler is called when the XML parser finds a - reference to an external parsed general entity. This can - be a reference to a file or URL, for example. See <link - linkend="example.xml-external-entity">the external entity - example</link> for a demonstration. - </entry> - </row> - </tbody> + <thead> + <row> + <entry>PHP function to set handler</entry> + <entry>Event description</entry> + </row> + </thead> + <tbody> + <row> + <entry><function>xml_set_element_handler</function></entry> + <entry> + Element events are issued whenever the XML parser + encounters start or end tags. There are separate handlers + for start tags and end tags. + </entry> + </row> + <row> + <entry> + <function>xml_set_character_data_handler</function> + </entry> + <entry> + Character data is roughly all the non-markup contents of + XML documents, including whitespace between tags. Note + that the XML parser does not add or remove any whitespace, + it is up to the application (you) to decide whether + whitespace is significant. + </entry> + </row> + <row> + <entry> + <function>xml_set_processing_instruction_handler</function> + </entry> + <entry> + PHP programmers should be familiar with processing + instructions (PIs) already. <?php ?> is a processing + instruction, where <replaceable>php</replaceable> is called + the "PI target". The handling of these are + application-specific, except that all PI targets starting + with "XML" are reserved. + </entry> + </row> + <row> + <entry><function>xml_set_default_handler</function></entry> + <entry> + What goes not to another handler goes to the default + handler. You will get things like the XML and document + type declarations in the default handler. + </entry> + </row> + <row> + <entry> + <function>xml_set_unparsed_entity_decl_handler</function> + </entry> + <entry> + This handler will be called for declaration of an unparsed + (NDATA) entity. + </entry> + </row> + <row> + <entry> + <function>xml_set_notation_decl_handler</function> + </entry> + <entry> + This handler is called for declaration of a notation. + </entry> + </row> + <row> + <entry> + <function>xml_set_external_entity_ref_handler</function> + </entry> + <entry> + This handler is called when the XML parser finds a + reference to an external parsed general entity. This can + be a reference to a file or URL, for example. See <link + linkend="example.xml-external-entity">the external entity + example</link> for a demonstration. + </entry> + </row> + </tbody> </tgroup> </table> </para> @@ -313,29 +313,29 @@ <example> <title>Map XML to HTML</title> <para> - This example maps tags in an XML document directly to HTML - tags. Elements not found in the "map array" are ignored. Of - course, this example will only work with a specific XML - document type. - <programlisting role="php"> + This example maps tags in an XML document directly to HTML + tags. Elements not found in the "map array" are ignored. Of + course, this example will only work with a specific XML + document type. + <programlisting role="php"> $file = "data.xml"; $map_array = array( - "BOLD" => "B", - "EMPHASIS" => "I", - "LITERAL" => "TT" + "BOLD" => "B", + "EMPHASIS" => "I", + "LITERAL" => "TT" ); function startElement($parser, $name, $attrs) { global $map_array; if ($htmltag = $map_array[$name]) { - print "<$htmltag>"; + print "<$htmltag>"; } } function endElement($parser, $name) { global $map_array; if ($htmltag = $map_array[$name]) { - print "</$htmltag>"; + print "</$htmltag>"; } } @@ -360,7 +360,7 @@ } } xml_parser_free($xml_parser); - </programlisting> + </programlisting> </para> </example> </para> @@ -501,7 +501,7 @@ print "parse complete\n"; xml_parser_free($xml_parser); -?> +?> </programlisting> </example> </para> @@ -509,33 +509,33 @@ <example> <title>xmltest.xml</title> <programlisting role="xml"> -<?xml version='1.0'?> +<?xml version='1.0'?> <!DOCTYPE chapter SYSTEM "/just/a/test.dtd" [ -<!ENTITY plainEntity "FOO entity"> -<!ENTITY systemEntity SYSTEM "xmltest2.xml"> -]> -<chapter> - <TITLE>Title &plainEntity;</TITLE> - <para> - <informaltable> - <tgroup cols="3"> - <tbody> - <row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> - <row><entry>a2</entry><entry>c2</entry></row> - <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> - </tbody> - </tgroup> - </informaltable> - </para> +<!ENTITY plainEntity "FOO entity"> +<!ENTITY systemEntity SYSTEM "xmltest2.xml"> +]> +<chapter> + <TITLE>Title &plainEntity;</TITLE> + <para> + <informaltable> + <tgroup cols="3"> + <tbody> + <row><entry>a1</entry><entry morerows="1">b1</entry><entry>c1</entry></row> + <row><entry>a2</entry><entry>c2</entry></row> + <row><entry>a3</entry><entry>b3</entry><entry>c3</entry></row> + </tbody> + </tgroup> + </informaltable> + </para> &systemEntity; - <sect1 id="about"> - <title>About this Document</title> - <para> - <!-- this is a comment --> - <?php print 'Hi! This is PHP version '.phpversion(); ?> - </para> - </sect1> -</chapter> + <sect1 id="about"> + <title>About this Document</title> + <para> + <!-- this is a comment --> + <?php print 'Hi! This is PHP version '.phpversion(); ?> + </para> + </sect1> +</chapter> </programlisting> </example> </para> @@ -544,15 +544,15 @@ <example> <title>xmltest2.xml</title> <programlisting role="xml"> -<?xml version="1.0"?> +<?xml version="1.0"?> <!DOCTYPE foo [ -<!ENTITY testEnt "test entity"> -]> -<foo> - <element attrib="value"/> +<!ENTITY testEnt "test entity"> +]> +<foo> + <element attrib="value"/> &testEnt; - <?php print "This is some more PHP code being executed."; ?> -</foo> + <?php print "This is some more PHP code being executed."; ?> +</foo> </programlisting> </example> </para> @@ -580,15 +580,15 @@ <varlistentry> <term><parameter>encoding</parameter> (optional)</term> <listitem> - <para> - Which character encoding the parser should use. The - following character encodings are supported: - <simplelist> - <member><literal>ISO-8859-1</literal> (default)</member> - <member><literal>US-ASCII</literal></member> - <member><literal>UTF-8</literal></member> - </simplelist> - </para> + <para> + Which character encoding the parser should use. The + following character encodings are supported: + <simplelist> + <member><literal>ISO-8859-1</literal> (default)</member> + <member><literal>US-ASCII</literal></member> + <member><literal>UTF-8</literal></member> + </simplelist> + </para> </listitem> </varlistentry> </variablelist> @@ -602,7 +602,7 @@ <refentry id="function.xml-set-object"> <refnamediv> <refname>xml_set_object</refname> - <refpurpose>Use XML Parser withing an object</refpurpose> + <refpurpose>Use XML Parser within an object</refpurpose> </refnamediv> <refsect1> <title>Description</title> @@ -614,9 +614,9 @@ </funcprototype> </funcsynopsis> <para> - This function makes <parameter>parser</parameter> useable from - within <parameter>object</parameter>. All callback functions - settet via <function>xml_set_element_handler</function> etc are + This function allows to use <parameter>parser</parameter> inside + <parameter>object</parameter>. All callback functions could be + set with <function>xml_set_element_handler</function> etc and assumed to be methods of <parameter>object</parameter>. </para> <programlisting role="php"> @@ -625,14 +625,14 @@ var $parser; function xml() { - $this->parser = xml_parser_create(); - xml_set_object($this->parser,&$this); - xml_set_element_handler($this->parser,"tag_open","tag_close"); - xml_set_character_data_handler($this->parser,"cdata"); + $this->parser = xml_parser_create(); + xml_set_object($this->parser,&$this); + xml_set_element_handler($this->parser,"tag_open","tag_close"); + xml_set_character_data_handler($this->parser,"cdata"); } function parse($data) { - xml_parse($this->parser,$data); + xml_parse($this->parser,$data); } function tag_open($parser,$tag,$attributes) { @@ -650,17 +650,9 @@ } // end of class xml $xml_parser = new xml(); -$xml_parser->parse("<A ID=\"hallo\">PHP</A>"); -?> - </programlisting> - <para> - <note> - <para> - <function>xml_set_object</function> handling was added in PHP - 4.0. - </para> - </note> - </para> +$xml_parser->parse("<A ID=\"hallo\">PHP</A>"); +?> + </programlisting> </refsect1> </refentry> @@ -709,43 +701,43 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>name</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>name</parameter>, contains - the name of the element for which this handler is called. If - <link linkend="xml.case-folding">case-folding</link> is in - effect for this parser, the element name will be in uppercase - letters. - </simpara> + <simpara> + The second parameter, <parameter>name</parameter>, contains + the name of the element for which this handler is called. If + <link linkend="xml.case-folding">case-folding</link> is in + effect for this parser, the element name will be in uppercase + letters. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>attribs</parameter></term> <listitem> - <simpara> - The third parameter, <parameter>attribs</parameter>, contains - an associative array with the element's attributes (if any). - The keys of this array are the attribute names, the values - are the attribute values. Attribute names are <link - linkend="xml.case-folding">case-folded</link> on the same - criteria as element names. Attribute values are - <emphasis>not</emphasis> case-folded. - </simpara> - <simpara> - The original order of the attributes can be retrieved by - walking through <parameter>attribs</parameter> the normal - way, using <function>each</function>. The first key in the - array was the first attribute, and so on. - </simpara> + <simpara> + The third parameter, <parameter>attribs</parameter>, contains + an associative array with the element's attributes (if any). + The keys of this array are the attribute names, the values + are the attribute values. Attribute names are <link + linkend="xml.case-folding">case-folded</link> on the same + criteria as element names. Attribute values are + <emphasis>not</emphasis> case-folded. + </simpara> + <simpara> + The original order of the attributes can be retrieved by + walking through <parameter>attribs</parameter> the normal + way, using <function>each</function>. The first key in the + array was the first attribute, and so on. + </simpara> </listitem> </varlistentry> </variablelist> @@ -764,23 +756,23 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>name</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>name</parameter>, contains - the name of the element for which this handler is called. If - <link linkend="xml.case-folding">case-folding</link> is in - effect for this parser, the element name will be in uppercase - letters. - </simpara> + <simpara> + The second parameter, <parameter>name</parameter>, contains + the name of the element for which this handler is called. If + <link linkend="xml.case-folding">case-folding</link> is in + effect for this parser, the element name will be in uppercase + letters. + </simpara> </listitem> </varlistentry> </variablelist> @@ -794,7 +786,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -835,19 +829,19 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>data</parameter>, contains - the character data as a string. - </simpara> + <simpara> + The second parameter, <parameter>data</parameter>, contains + the character data as a string. + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -861,7 +855,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -927,14 +923,14 @@ <varlistentry> <term><parameter>target</parameter></term> <listitem><simpara> - The second parameter, <parameter>target</parameter>, contains - the PI target.</simpara></listitem> + The second parameter, <parameter>target</parameter>, contains + the PI target.</simpara></listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem><simpara> - The third parameter, <parameter>data</parameter>, contains - the PI data.</simpara></listitem> + The third parameter, <parameter>data</parameter>, contains + the PI data.</simpara></listitem> </varlistentry> </variablelist></para> <para> @@ -946,7 +942,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -986,27 +984,27 @@ <variablelist> <varlistentry> <term> - <parameter>parser</parameter> + <parameter>parser</parameter> </term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>data</parameter> + <parameter>data</parameter> </term> <listitem> - <simpara> - The second parameter, <parameter>data</parameter>, contains - the character data. This may be the XML declaration, - document type declaration, entities or other data for which - no other handler exists. - </simpara> + <simpara> + The second parameter, <parameter>data</parameter>, contains + the character data. This may be the XML declaration, + document type declaration, entities or other data for which + no other handler exists. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1020,7 +1018,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1080,54 +1080,54 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>entityName</parameter></term> <listitem> - <simpara> - The name of the entity that is about to be defined. - </simpara> + <simpara> + The name of the entity that is about to be defined. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>base</parameter></term> <listitem><simpara> - This is the base for resolving the system identifier - (<parameter>systemId</parameter>) of the external - entity. Currently this parameter will always be set to - an empty string. - </simpara> + This is the base for resolving the system identifier + (<parameter>systemId</parameter>) of the external + entity. Currently this parameter will always be set to + an empty string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - System identifier for the external entity. - </simpara> + <simpara> + System identifier for the external entity. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>publicId</parameter></term> <listitem> - <simpara> - Public identifier for the external entity. - </simpara> + <simpara> + Public identifier for the external entity. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>notationName</parameter></term> <listitem> - <simpara> - Name of the notation of this entity (see - <function>xml_set_notation_decl_handler</function>). - </simpara> + <simpara> + Name of the notation of this entity (see + <function>xml_set_notation_decl_handler</function>). + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -1140,7 +1140,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1192,56 +1194,56 @@ <variablelist> <varlistentry> <term> - <parameter>parser</parameter> + <parameter>parser</parameter> </term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the - handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the + handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>notationName</parameter></term> <listitem> - <simpara> - This is the notation's <parameter>name</parameter>, as per - the notation format described above. - </simpara> + <simpara> + This is the notation's <parameter>name</parameter>, as per + the notation format described above. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>base</parameter> + <parameter>base</parameter> </term> <listitem> - <simpara> - This is the base for resolving the system identifier - (<parameter>systemId</parameter>) of the notation - declaration. Currently this parameter will always be set to - an empty string. - </simpara> + <simpara> + This is the base for resolving the system identifier + (<parameter>systemId</parameter>) of the notation + declaration. Currently this parameter will always be set to + an empty string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - System identifier of the external notation - declaration. - </simpara> + <simpara> + System identifier of the external notation + declaration. + </simpara> </listitem> </varlistentry> <varlistentry> <term> - <parameter>publicId</parameter> + <parameter>publicId</parameter> </term> <listitem> - <simpara> - Public identifier of the external notation - declaration. - </simpara> + <simpara> + Public identifier of the external notation + declaration. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1256,7 +1258,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1307,53 +1311,53 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - The first parameter, <replaceable>parser</replaceable>, is a - reference to the XML parser calling the handler. - </simpara> + <simpara> + The first parameter, <replaceable>parser</replaceable>, is a + reference to the XML parser calling the handler. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>openEntityNames</parameter></term> <listitem> - <simpara> - The second parameter, <parameter>openEntityNames</parameter>, - is a space-separated list of the names of the entities that - are open for the parse of this entity (including the name of - the referenced entity). - </simpara> + <simpara> + The second parameter, <parameter>openEntityNames</parameter>, + is a space-separated list of the names of the entities that + are open for the parse of this entity (including the name of + the referenced entity). + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>base</parameter></term> <listitem> - <simpara> - This is the base for resolving the system identifier - (<parameter>systemid</parameter>) of the external entity. - Currently this parameter will always be set to an empty - string. - </simpara> + <simpara> + This is the base for resolving the system identifier + (<parameter>systemid</parameter>) of the external entity. + Currently this parameter will always be set to an empty + string. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>systemId</parameter></term> <listitem> - <simpara> - The fourth parameter, <parameter>systemId</parameter>, is the - system identifier as specified in the entity declaration. - </simpara> + <simpara> + The fourth parameter, <parameter>systemId</parameter>, is the + system identifier as specified in the entity declaration. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>publicId</parameter></term> <listitem> - <simpara> - The fifth parameter, <parameter>publicId</parameter>, is the - public identifier as specified in the entity declaration, or - an empty string if none was specified; the whitespace in the - public identifier will have been normalized as required by - the XML spec. - </simpara> + <simpara> + The fifth parameter, <parameter>publicId</parameter>, is the + public identifier as specified in the entity declaration, or + an empty string if none was specified; the whitespace in the + public identifier will have been normalized as required by + the XML spec. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1368,7 +1372,9 @@ <parameter>parser</parameter> is not a parser. </para> <para> - There is currently no support for object/method handlers. + There is currently no support for object/method handlers. See + <function>xml_set_object</function> for using the XML parser + within an object. </para> </refsect1> </refentry> @@ -1395,29 +1401,29 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to use. - </simpara> + <simpara> + A reference to the XML parser to use. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>data</parameter></term> <listitem> - <simpara> - Chunk of data to parse. A document may be parsed piece-wise - by calling <function>xml_parse</function> several times with - new data, as long as the <parameter>isFinal</parameter> - parameter is set and true when the last data is parsed. - </simpara> + <simpara> + Chunk of data to parse. A document may be parsed piece-wise + by calling <function>xml_parse</function> several times with + new data, as long as the <parameter>isFinal</parameter> + parameter is set and true when the last data is parsed. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>isFinal</parameter> (optional)</term> <listitem> - <simpara> - If set and true, <parameter>data</parameter> is the last - piece of data sent in this parse. - </simpara> + <simpara> + If set and true, <parameter>data</parameter> is the last + piece of data sent in this parse. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1458,9 +1464,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get error code from. - </simpara> + <simpara> + A reference to the XML parser to get error code from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1492,9 +1498,9 @@ <varlistentry> <term><parameter>code</parameter></term> <listitem> - <simpara> - An error code from <function>xml_get_error_code</function>. - </simpara> + <simpara> + An error code from <function>xml_get_error_code</function>. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1526,9 +1532,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get line number from. - </simpara> + <simpara> + A reference to the XML parser to get line number from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1563,9 +1569,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get column number from. - </simpara> + <simpara> + A reference to the XML parser to get column number from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1600,9 +1606,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get byte index from. - </simpara> + <simpara> + A reference to the XML parser to get byte index from. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1615,6 +1621,220 @@ </refsect1> </refentry> + <refentry id="function.xml-parse-into-struct"> + <refnamediv> + <refname>xml_parse_into_struct</refname> + <refpurpose>Parse XML data into an array structure</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>int <function>xml_parse_into_struct</function></funcdef> + <paramdef>int <parameter>parser</parameter></paramdef> + <paramdef>string <parameter>data</parameter></paramdef> + <paramdef>array <parameter>&values</parameter></paramdef> + <paramdef>array <parameter>&index</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + This function parses an XML file into 2 parallel array + structures, one (<parameter>index</parameter>) containing pointers + to the location of the appropriate values in the + <parameter>values</parameter> array. These last two parameters + must be passed by reference. + </para> + <para> + Below is an example that illustrates the internal structure of + the arrays being generated by the function. We use a simple + <literal>note</literal> tag embeded inside a + <literal>para</literal> tag, and then we parse this an print out + the structures generated: + <informalexample> + <programlisting> +$simple = "<para><note>simple note</note></para>"; +$p = xml_parser_create(); +xml_parse_into_struct($p,$simple,&$vals,&$index); +xml_parser_free($p); +echo "Index array\n"; +print_r($index); +echo "\nVals array\n"; +print_r($vals); + </programlisting> + </informalexample> + When we run that code, the output will be: + <informalexample> + <programlisting> +Index array +Array +( + [PARA] => Array + ( + [0] => 0 + [1] => 2 + ) + + [NOTE] => Array + ( + [0] => 1 + ) + +) + +Vals array +Array +( + [0] => Array + ( + [tag] => PARA + [type] => open + [level] => 1 + ) + + [1] => Array + ( + [tag] => NOTE + [type] => complete + [level] => 2 + [value] => simple note + ) + + [2] => Array + ( + [tag] => PARA + [type] => close + [level] => 1 + ) + +) + </programlisting> + </informalexample> + </para> + <para> + Event-driven parsing (based on the expat library) can get + complicated when you have an XML document that is complex. + This function does not produce a DOM style object, but it + generates structures amenable of being transversed in a tree + fashion. Thus, we can create objects representing the data + in the XML file easily. Let's consider the following XML file + representing a small database of aminoacids information: + <example> + <title>moldb.xml - small database of molecular information</title> + <programlisting> +<?xml version="1.0"?> +<moldb> + + <molecule> + <name>Alanine</name> + <symbol>ala</symbol> + <code>A</code> + <type>hydrophobic</type> + </molecule> + + <molecule> + <name>Lysine</name> + <symbol>lys</symbol> + <code>K</code> + <type>charged</type> + </molecule> + +</moldb> + </programlisting> + </example> + And some code to parse the document and generate the appropriate + objects: + <example> + <title> + parsemoldb.php - parses moldb.xml into and array of + molecular objects + </title> + <programlisting role="php"> +<?php + +class AminoAcid { + var $name; // aa name + var $symbol; // three letter symbol + var $code; // one letter code + var $type; // hydrophobic, charged or neutral + + function AminoAcid ($aa) { + foreach ($aa as $k=>$v) + $this->$k = $aa[$k]; + } +} + +function readDatabase($filename) { + // read the xml database of aminoacids + $data = implode("",file($filename)); + $parser = xml_parser_create(); + xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0); + xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1); + xml_parse_into_struct($parser,$data,&$values,&$tags); + xml_parser_free($parser); + + // loop through the structures + foreach ($tags as $key=>$val) { + if ($key == "molecule") { + $molranges = $val; + // each contiguous pair of array entries are the + // lower and upper range for each molecule definition + for ($i=0; $i < count($molranges); $i+=2) { + $offset = $molranges[$i] + 1; + $len = $molranges[$i + 1] - $offset; + $tdb[] = parseMol(array_slice($values, $offset, $len)); + } + } else { + continue; + } + } + return $tdb; +} + +function parseMol($mvalues) { + for ($i=0; $i < count($mvalues); $i++) + $mol[$mvalues[$i]["tag"]] = $mvalues[$i]["value"]; + return new AminoAcid($mol); +} + +$db = readDatabase("moldb.xml"); +echo "** Database of AminoAcid objects:\n"; +print_r($db); + +?> + </programlisting> + </example> + After executing <filename>parsemoldb.php</filename>, the variable + <varname>$db</varname> contains an array of + <classname>AminoAcid</classname> objects, and the output of the + script confirms that: + <informalexample> + <programlisting> +** Database of AminoAcid objects: +Array +( + [0] => aminoacid Object + ( + [name] => Alanine + [symbol] => ala + [code] => A + [type] => hydrophobic + ) + + [1] => aminoacid Object + ( + [name] => Lysine + [symbol] => lys + [code] => K + [type] => charged + ) + +) + </programlisting> + </informalexample> + </para> + </refsect1> + </refentry> + <refentry id="function.xml-parser-free"> <refnamediv> <refname>xml_parser_free</refname> @@ -1633,9 +1853,9 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to free. - </simpara> + <simpara> + A reference to the XML parser to free. + </simpara> </listitem> </varlistentry> </variablelist></para> @@ -1667,25 +1887,25 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to set an option in. - </simpara> + <simpara> + A reference to the XML parser to set an option in. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>option</parameter></term> <listitem> - <simpara> - Which option to set. See below. - </simpara> + <simpara> + Which option to set. See below. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>value</parameter></term> <listitem> - <simpara> - The option's new value. - </simpara> + <simpara> + The option's new value. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1701,34 +1921,34 @@ <title>XML parser options</title> <tgroup cols="3"> <thead> - <row> - <entry>Option constant</entry> - <entry>Data type</entry> - <entry>Description</entry> - </row> + <row> + <entry>Option constant</entry> + <entry>Data type</entry> + <entry>Description</entry> + </row> </thead> <tbody> - <row> - <entry>XML_OPTION_CASE_FOLDING</entry> - <entry>integer</entry> - <entry> - Controls whether <link - linkend="xml.case-folding">case-folding</link> is enabled - for this XML parser. Enabled by default. - </entry> - </row> - <row> - <entry>XML_OPTION_TARGET_ENCODING</entry> - <entry>string</entry> - <entry> - Sets which <link linkend="xml.encoding">target - encoding</link> to use in this XML parser. By default, it - is set to the same as the source encoding used by - <function>xml_parser_create</function>. Supported target - encodings are <literal>ISO-8859-1</literal>, - <literal>US-ASCII</literal> and <literal>UTF-8</literal>. - </entry> - </row> + <row> + <entry>XML_OPTION_CASE_FOLDING</entry> + <entry>integer</entry> + <entry> + Controls whether <link + linkend="xml.case-folding">case-folding</link> is enabled + for this XML parser. Enabled by default. + </entry> + </row> + <row> + <entry>XML_OPTION_TARGET_ENCODING</entry> + <entry>string</entry> + <entry> + Sets which <link linkend="xml.encoding">target + encoding</link> to use in this XML parser. By default, it + is set to the same as the source encoding used by + <function>xml_parser_create</function>. Supported target + encodings are <literal>ISO-8859-1</literal>, + <literal>US-ASCII</literal> and <literal>UTF-8</literal>. + </entry> + </row> </tbody> </tgroup> </table> @@ -1757,20 +1977,20 @@ <varlistentry> <term><parameter>parser</parameter></term> <listitem> - <simpara> - A reference to the XML parser to get an option - from. - </simpara> + <simpara> + A reference to the XML parser to get an option + from. + </simpara> </listitem> </varlistentry> <varlistentry> <term><parameter>option</parameter></term> <listitem> - <simpara> - Which option to fetch. See - <function>xml_parser_set_option</function> for a list of - options. - </simpara> + <simpara> + Which option to fetch. See + <function>xml_parser_set_option</function> for a list of + options. + </simpara> </listitem> </varlistentry> </variablelist> @@ -1844,33 +2064,33 @@ <title>UTF-8 encoding</title> <tgroup cols="3"> <thead> - <row> - <entry>bytes</entry> - <entry>bits</entry> - <entry>representation</entry> - </row> + <row> + <entry>bytes</entry> + <entry>bits</entry> + <entry>representation</entry> + </row> </thead> <tbody> - <row> - <entry>1</entry> - <entry>7</entry> - <entry>0bbbbbbb</entry> - </row> - <row> - <entry>2</entry> - <entry>11</entry> - <entry>110bbbbb 10bbbbbb</entry> - </row> - <row> - <entry>3</entry> - <entry>16</entry> - <entry>1110bbbb 10bbbbbb 10bbbbbb</entry> - </row> - <row> - <entry>4</entry> - <entry>21</entry> - <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry> - </row> + <row> + <entry>1</entry> + <entry>7</entry> + <entry>0bbbbbbb</entry> + </row> + <row> + <entry>2</entry> + <entry>11</entry> + <entry>110bbbbb 10bbbbbb</entry> + </row> + <row> + <entry>3</entry> + <entry>16</entry> + <entry>1110bbbb 10bbbbbb 10bbbbbb</entry> + </row> + <row> + <entry>4</entry> + <entry>21</entry> + <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry> + </row> </tbody> </tgroup> </table> Index: phpdoc/it/chapters/install.xml diff -u phpdoc/it/chapters/install.xml:1.8 phpdoc/it/chapters/install.xml:1.9 --- phpdoc/it/chapters/install.xml:1.8 Wed Oct 11 06:39:22 2000 +++ phpdoc/it/chapters/install.xml Thu Nov 2 00:26:44 2000 @@ -272,7 +272,7 @@ </para> </sect2> - <sect2> + <sect2 id="install.building"> <title>Building</title> <simpara> When PHP is configured, you are ready to build the CGI executable @@ -282,7 +282,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.testing"> <title>Testing</title> <simpara> If you have built PHP as a CGI program, you may test your build @@ -292,7 +292,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.benchmarking"> <title>Benchmarking</title> <simpara> If you have built PHP as a CGI program, you may benchmark your @@ -1667,8 +1667,8 @@ <filename>/usr/local/lib</filename> </para> <para> - PHP 4: Sets the path in which to look for php.ini. Defaults to - <filename>/usr/local/lib</filename> + PHP 4: Sets the path in which to look for <filename>php.ini</filename>. + Defaults to <filename>/usr/local/lib</filename> </para> </listitem> </varlistentry> @@ -2121,6 +2121,14 @@ PHP 3, PHP 4: Disable the URL-aware fopen wrapper that allows accessing files via http or ftp. </para> + <warning> + <para> + This switch is only available for PHP versions up to 4.0.3, newer + versions provide an INI parameter called + <parameter>allow_url_fopen</parameter> instead of forcing you to + decide upon this feature at compile time. + </para> + </warning> </listitem> </varlistentry> @@ -2657,7 +2665,7 @@ </itemizedlist> </para> - <sect2> + <sect2 id="install.windows.general"> <title>General Installation Steps</title> <para> @@ -2736,7 +2744,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.iis3"> <title>Windows 95/98/NT and PWS/IIS 3</title> <simpara> @@ -2885,7 +2893,7 @@ </sect2> - <sect2> + <sect2 id="install.windowsnt.iis4"> <title>Windows NT and IIS 4</title> <simpara> @@ -2944,7 +2952,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.apache"> <title>Windows 9x/NT and Apache 1.3.x</title> <simpara> @@ -3005,7 +3013,7 @@ </sect2> - <sect2> + <sect2 id="install.windows.omnihttpd"> <title>Omni HTTPd 2.0b1 for Windows</title> <simpara> @@ -3057,7 +3065,42 @@ </sect2> - <sect2> + <sect2 id="install.windows.installer"> + <title>Windows Installshield</title> + + <para> + The Windows PHP installer available from the downloads page at + <ulink url="&url.php;">&url.php;</ulink> installs the CGI version of + PHP and, for IIS, PWS, and Xitami, configures the web server as well. + </para> + + <simpara> + Install your choosen http server on your system and make sure it all works. + </simpara> + + <simpara> + Run the installer exe file and follow the instructions provided by the + installation wizard. Two types of installation are supported - standard, + which provides sensible defaults for all the settings it can, and + advanced, which asks questions as it goes along. + </simpara> + + <simpara> + The installation wizard gathers enough information to set up the + <filename>php.ini</filename> file and configure the web server to use PHP. + For IIS and also PWS on NT Workstation, a list of all the nodes on the server + with script map settings is displayed, and you can choose those nodes to which + you wish to add the PHP script mappings. + </simpara> + + <simpara> + Once the installation has completed the installer will inform you if you + need to restart your system, restart the server, or just start using PHP. + </simpara> + + </sect2> + + <sect2 id="install.windows.modules"> <title>PHP Modules</title> <para> @@ -3154,7 +3197,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.bugreports"> <title>Bug reports</title> <simpara> If you think you have found a bug in PHP, please report it. The @@ -3165,7 +3208,7 @@ </simpara> </sect2> - <sect2> + <sect2 id="install.otherproblems"> <title>Other problems</title> <simpara>