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
This commit is contained in:
Egon Schmid 1999-12-25 08:47:51 +00:00
parent 3eb7b85174
commit b0bc1fa835

View file

@ -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 <ulink
url="http://www.w3.org/XML/">http://www.w3.org/XML/</ulink>.
url="&url.xml;">&url.xml;</ulink>.
</para>
</sect2>
<sect2 id="xml.install">
<title>Installation</title>
<para>
This extension uses <productname>expat</productname>, which can
be found at <ulink
url="http://www.jclark.com/xml/">http://www.jclark.com/xml/</ulink>.
The Makefile that comes with expat does not build a library by
be found at <ulink url="&url.expat;">&url.expat;</ulink>. The
Makefile that comes with expat does not build a library by
default, you can use this make rule for that:
<programlisting role="makefile">
libexpat.a: $(OBJS)
@ -29,7 +28,7 @@ libexpat.a: $(OBJS)
ranlib $@
</programlisting>
A source RPM package of expat can be found at <ulink
url="http://www.guardian.no/~ssb/phpxml.html">http://www.guardian.no/~ssb/phpxml.html</ulink>.
url="&url.expat.rpm;">&url.expat.rpm;</ulink>.
</para>
<para>
Note that if you are using Apache-1.3.7 or later, you already
@ -53,6 +52,7 @@ libexpat.a: $(OBJS)
Build PHP. <emphasis>Tada!</emphasis> That should be it.
</para>
</sect2>
<sect2 id="xml.about">
<title>About This Extension</title>
<para>
@ -302,7 +302,6 @@ while ($data = fread($fp, 4096)) {
}
}
xml_parser_free($xml_parser);
</programlisting>
</example>
</para>
@ -388,8 +387,9 @@ $file = "xmltest.xml";
function trustedFile($file) {
// only trust local files owned by ourselves
if (!eregi("^([a-z]+)://", $file) &amp;&amp; fileowner($file) == getmyuid()) {
return true;
if (!eregi("^([a-z]+)://", $file)
&amp;&amp; fileowner($file) == getmyuid()) {
return true;
}
return false;
}
@ -398,7 +398,8 @@ function startElement($parser, $name, $attribs) {
print "&amp;lt;&lt;font color=\"#0000cc\"&gt;$name&lt;/font&gt;";
if (sizeof($attribs)) {
while (list($k, $v) = each($attribs)) {
print " &lt;font color=\"#009900\"&gt;$k&lt;/font&gt;=\"&lt;font color=\"#990000\"&gt;$v&lt;/font&gt;\"";
print " &lt;font color=\"#009900\"&gt;$k&lt;/font&gt;=\"&lt;font
color=\"#990000\"&gt;$v&lt;/font&gt;\"";
}
}
print "&amp;gt;";
@ -422,7 +423,8 @@ function PIHandler($parser, $target, $data) {
if (trustedFile($parser_file[$parser])) {
eval($data);
} else {
printf("Untrusted PHP code: &lt;i&gt;%s&lt;/i&gt;", htmlspecialchars($data));
printf("Untrusted PHP code: &lt;i&gt;%s&lt;/i&gt;",
htmlspecialchars($data));
}
break;
}
@ -430,9 +432,11 @@ function PIHandler($parser, $target, $data) {
function defaultHandler($parser, $data) {
if (substr($data, 0, 1) == "&amp;" &amp;&amp; substr($data, -1, 1) == ";") {
printf('&lt;font color="#aa00aa"&gt;%s&lt;/font&gt;', htmlspecialchars($data));
printf('&lt;font color="#aa00aa"&gt;%s&lt;/font&gt;',
htmlspecialchars($data));
} else {
printf('&lt;font size="-1"&gt;%s&lt;/font&gt;', htmlspecialchars($data));
printf('&lt;font size="-1"&gt;%s&lt;/font&gt;',
htmlspecialchars($data));
}
}
@ -573,14 +577,16 @@ xml_parser_free($xml_parser);
<variablelist>
<varlistentry>
<term><parameter>encoding</parameter> (optional)</term>
<listitem><para>
<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>
</simplelist>
</para>
</listitem>
</varlistentry>
</variablelist>
@ -680,7 +686,8 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
<parameter>endElementHandler</parameter> are strings containing
the names of functions that must exist when
<function>xml_parse</function> is called for
<parameter>parser</parameter>.</para>
<parameter>parser</parameter>.
</para>
<para>
The function named by <parameter>startElementHandler</parameter>
must accept three parameters:
@ -692,10 +699,14 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
</funcsynopsis>
<variablelist>
<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></listitem>
<term><parameter>parser</parameter></term>
<listitem>
<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>
@ -1019,7 +1030,8 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
external entity declaration with an NDATA declaration, like the
following:
<programlisting role="xml">
&lt;!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | <parameter>systemId</parameter>} NDATA <parameter>notationName</parameter>&gt;
&lt;!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | <parameter>systemId</parameter>}
NDATA <parameter>notationName</parameter>&gt;
</programlisting>
</para>
<para>
@ -1063,7 +1075,9 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
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>
an empty string.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>systemId</parameter></term>
@ -1236,7 +1250,8 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
<parameter>parser</parameter>. <parameter>handler</parameter> is
a string containing the name of a function that must exist when
<function>xml_parse</function> is called for
<parameter>parser</parameter>.</para>
<parameter>parser</parameter>.
</para>
<para>
The function named by <parameter>handler</parameter> must accept
five parameters, and should return an integer value. If the
@ -1244,7 +1259,7 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
value is returned), the XML parser will stop parsing and
<function>xml_get_error_code</function> will return <systemitem
class="constant">XML_ERROR_EXTERNAL_ENTITY_HANDLING</systemitem>.
<funcsynopsis>
<funcsynopsis>
<funcdef>int <replaceable>handler</replaceable></funcdef>
<paramdef>int <parameter>parser</parameter></paramdef>
<paramdef>string
@ -1345,7 +1360,8 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
<term><parameter>parser</parameter></term>
<listitem>
<simpara>
A reference to the XML parser to use.</simpara>
A reference to the XML parser to use.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
@ -1373,7 +1389,8 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
<para>
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.</para>
function returns true or false.
</para>
<para>
True is returned if the parse was successful, false if it was not
successful, or if <parameter>parser</parameter> does not refer to
@ -1567,8 +1584,11 @@ $xml_parser->parse("&lt;A ID=\"hallo\">PHP&lt;/A>");
<variablelist>
<varlistentry>
<term><parameter>parser</parameter></term>
<listitem><simpara>
A reference to the XML parser to free.</simpara></listitem>
<listitem>
<simpara>
A reference to the XML parser to free.
</simpara>
</listitem>
</varlistentry>
</variablelist></para>
<para>
@ -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