mirror of
https://github.com/php/doc-pt_br.git
synced 2026-03-23 22:52:12 +01:00
139 lines
3.6 KiB
XML
139 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: leonardolara Status: ready --><!-- CREDITS: fernandowobeto -->
|
|
<refentry xml:id="domdocument.xinclude" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>DOMDocument::xinclude</refname>
|
|
<refpurpose>
|
|
Substitui XIncludes em um objeto DOMDocument
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis role="DOMDocument">
|
|
<modifier>public</modifier> <type class="union"><type>int</type><type>false</type></type><methodname>DOMDocument::xinclude</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Este método substitui <link xlink:href="&url.xinclude.spec;">XIncludes</link> em um objeto DOMDocument.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Devido ao libxml2 resolver automaticamente entidades, este método produzirá
|
|
resultados inesperados se o arquivo XML incluído tiver um DTD anexado.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
&dom.parameter.options;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retorna o número de XIncludes no documento, -1 se algum processamento falhar,
|
|
ou &false; se não houver substituições.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de DOMDocument::xinclude()</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$xml = <<<EOD
|
|
<?xml version="1.0" ?>
|
|
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
<title>Books of the other guy..</title>
|
|
<para>
|
|
<xi:include href="examples/book.xml">
|
|
<xi:fallback>
|
|
<error>xinclude: book.xml not found</error>
|
|
</xi:fallback>
|
|
</xi:include>
|
|
</para>
|
|
</chapter>
|
|
EOD;
|
|
|
|
$dom = new DOMDocument;
|
|
|
|
// vamos ter uma saída bonita
|
|
$dom->preserveWhiteSpace = false;
|
|
$dom->formatOutput = true;
|
|
|
|
// carrega a string XML definida acima
|
|
$dom->loadXML($xml);
|
|
|
|
// substitui xincludes
|
|
$dom->xinclude();
|
|
|
|
echo $dom->saveXML();
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen role="xml">
|
|
<![CDATA[
|
|
<?xml version="1.0"?>
|
|
<chapter xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
<title>Books of the other guy..</title>
|
|
<para>
|
|
<row xml:base="/home/didou/book.xml">
|
|
<entry>The Grapes of Wrath</entry>
|
|
<entry>John Steinbeck</entry>
|
|
<entry>en</entry>
|
|
<entry>0140186409</entry>
|
|
</row>
|
|
<row xml:base="/home/didou/book.xml">
|
|
<entry>The Pearl</entry>
|
|
<entry>John Steinbeck</entry>
|
|
<entry>en</entry>
|
|
<entry>014017737X</entry>
|
|
</row>
|
|
<row xml:base="/home/didou/book.xml">
|
|
<entry>Samarcande</entry>
|
|
<entry>Amine Maalouf</entry>
|
|
<entry>fr</entry>
|
|
<entry>2253051209</entry>
|
|
</row>
|
|
</para>
|
|
</chapter>
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|