<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.domdocument.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'domdocument.xinclude.php',
    1 => 'DOMDocument::xinclude',
    2 => 'Substitutes XIncludes in a DOMDocument Object',
  ),
  'up' => 
  array (
    0 => 'class.domdocument.php',
    1 => 'DOMDocument',
  ),
  'prev' => 
  array (
    0 => 'domdocument.validate.php',
    1 => 'DOMDocument::validate',
  ),
  'next' => 
  array (
    0 => 'class.domdocumentfragment.php',
    1 => 'DOMDocumentFragment',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/dom/domdocument/xinclude.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="domdocument.xinclude" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DOMDocument::xinclude</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DOMDocument::xinclude</span> &mdash; <span class="dc-title">
   Substitutes XIncludes in a DOMDocument Object
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-domdocument.xinclude-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DOMDocument::xinclude</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   This method substitutes <a href="http://www.w3.org/TR/xinclude/" class="link external">&raquo;&nbsp;XIncludes</a> in a DOMDocument object.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    Due to libxml2 automatically resolving entities, this method will produce
    unexpected results if the included XML file have an attached DTD.
   </p>
  </p></blockquote>
 </div>

 <div class="refsect1 parameters" id="refsect1-domdocument.xinclude-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">options</code></dt>
     <dd>
      <p class="para">
  <a href="language.operators.bitwise.php" class="link">Bitwise <code class="literal">OR</code></a>
  of the <a href="libxml.constants.php" class="link">libxml option constants</a>.
</p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-domdocument.xinclude-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the number of XIncludes in the document, -1 if some processing failed,
   or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if there were no substitutions.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-domdocument.xinclude-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 DOMDocument::xinclude() example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$xml </span><span style="color: #007700">= &lt;&lt;&lt;EOD<br /></span><span style="color: #DD0000">&lt;?xml version="1.0" ?&gt;<br />&lt;chapter xmlns:xi="http://www.w3.org/2001/XInclude"&gt;<br /> &lt;title&gt;Books of the other guy..&lt;/title&gt;<br /> &lt;para&gt;<br />  &lt;xi:include href="examples/book.xml"&gt;<br />   &lt;xi:fallback&gt;<br />    &lt;error&gt;xinclude: book.xml not found&lt;/error&gt;<br />   &lt;/xi:fallback&gt;<br />  &lt;/xi:include&gt;<br /> &lt;/para&gt;<br />&lt;/chapter&gt;<br /></span><span style="color: #007700">EOD;<br /><br /></span><span style="color: #0000BB">$dom </span><span style="color: #007700">= new </span><span style="color: #0000BB">DOMDocument</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// let's have a nice output<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">preserveWhiteSpace </span><span style="color: #007700">= </span><span style="color: #0000BB">false</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">formatOutput </span><span style="color: #007700">= </span><span style="color: #0000BB">true</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">// load the XML string defined above<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loadXML</span><span style="color: #007700">(</span><span style="color: #0000BB">$xml</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// substitute xincludes<br /></span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">xinclude</span><span style="color: #007700">();<br /><br />echo </span><span style="color: #0000BB">$dom</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveXML</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;chapter xmlns:xi=&quot;http://www.w3.org/2001/XInclude&quot;&gt;
  &lt;title&gt;Books of the other guy..&lt;/title&gt;
  &lt;para&gt;
    &lt;row xml:base=&quot;/home/didou/book.xml&quot;&gt;
       &lt;entry&gt;The Grapes of Wrath&lt;/entry&gt;
       &lt;entry&gt;John Steinbeck&lt;/entry&gt;
       &lt;entry&gt;en&lt;/entry&gt;
       &lt;entry&gt;0140186409&lt;/entry&gt;
      &lt;/row&gt;
    &lt;row xml:base=&quot;/home/didou/book.xml&quot;&gt;
       &lt;entry&gt;The Pearl&lt;/entry&gt;
       &lt;entry&gt;John Steinbeck&lt;/entry&gt;
       &lt;entry&gt;en&lt;/entry&gt;
       &lt;entry&gt;014017737X&lt;/entry&gt;
      &lt;/row&gt;
    &lt;row xml:base=&quot;/home/didou/book.xml&quot;&gt;
       &lt;entry&gt;Samarcande&lt;/entry&gt;
       &lt;entry&gt;Amine Maalouf&lt;/entry&gt;
       &lt;entry&gt;fr&lt;/entry&gt;
       &lt;entry&gt;2253051209&lt;/entry&gt;
      &lt;/row&gt;
  &lt;/para&gt;
&lt;/chapter&gt;</pre>
</div>
    </div>
   </div>
  </p>
 </div>

</div><?php manual_footer($setup); ?>