mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
3eb7b85174
commit
b0bc1fa835
1 changed files with 48 additions and 28 deletions
|
@ -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) && 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);
|
|||
<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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</A>");
|
|||
external entity declaration with an NDATA declaration, like the
|
||||
following:
|
||||
<programlisting role="xml">
|
||||
<!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | <parameter>systemId</parameter>} NDATA <parameter>notationName</parameter>>
|
||||
<!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | <parameter>systemId</parameter>}
|
||||
NDATA <parameter>notationName</parameter>>
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
|
@ -1063,7 +1075,9 @@ $xml_parser->parse("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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("<A ID=\"hallo\">PHP</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
|
||||
|
|
Loading…
Reference in a new issue