<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xml.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.xml-parser-set-option.php',
    1 => 'xml_parser_set_option',
    2 => 'Установка значения настройки XML-анализатора',
  ),
  'up' => 
  array (
    0 => 'ref.xml.php',
    1 => 'Функции парсера XML',
  ),
  'prev' => 
  array (
    0 => 'function.xml-parser-get-option.php',
    1 => 'xml_parser_get_option',
  ),
  'next' => 
  array (
    0 => 'function.xml-set-character-data-handler.php',
    1 => 'xml_set_character_data_handler',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/xml/functions/xml-parser-set-option.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.xml-parser-set-option" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xml_parser_set_option</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">xml_parser_set_option</span> &mdash; <span class="dc-title">Установка значения настройки XML-анализатора</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.xml-parser-set-option-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>xml_parser_set_option</strong></span>(<span class="methodparam"><span class="type"><a href="class.xmlparser.php" class="type XMLParser">XMLParser</a></span> <code class="parameter">$parser</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$option</code></span>, <span class="methodparam"><span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Устанавливает значение настройки XML-анализатора.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xml-parser-set-option-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">parser</code></dt>
     <dd>
      <p class="para">
       Ссылка на XML-анализатор.
      </p>
     </dd>
    
    
     <dt><code class="parameter">option</code></dt>
     <dd>
      <p class="para">
       Какую настройку требуется установить. Смотрите ниже.
      </p>
      <p class="para">
       Доступны следующие настройки:
       <table class="doctable table">
        <caption><strong>Настройки XML-анализатора</strong></caption>
        
         <thead>
          <tr>
           <th>Константа</th>
           <th>Тип данных</th>
           <th>Описание</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td><strong><code><a href="xml.constants.php#constant.xml-option-case-folding">XML_OPTION_CASE_FOLDING</a></code></strong></td>
           <td>bool</td>
           <td>
            Требуется ли включить <a href="xml.case-folding.php" class="link">case-folding</a> для этого
            анализатора. Включено по умолчанию.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="xml.constants.php#constant.xml-option-parse-huge">XML_OPTION_PARSE_HUGE</a></code></strong></td>
           <td>bool</td>
           <td>
            Позволяет разбирать документы размером более 10 МБ.
            Настройка должна быть включена только в том случае, если размер документа ограничен,
            поскольку в противном случае это может привести к DoS.
            Настройка доступна только при использовании libxml2.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="xml.constants.php#constant.xml-option-skip-tagstart">XML_OPTION_SKIP_TAGSTART</a></code></strong></td>
           <td>integer</td>
           <td>
            Задаёт количество символов с начала имени тега, которые следует
            пропустить.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="xml.constants.php#constant.xml-option-skip-white">XML_OPTION_SKIP_WHITE</a></code></strong></td>
           <td>bool</td>
           <td>
            Требуется ли пропускать значения, состоящие из пробелов.
           </td>
          </tr>

          <tr>
           <td><strong><code><a href="xml.constants.php#constant.xml-option-target-encoding">XML_OPTION_TARGET_ENCODING</a></code></strong></td>
           <td>string</td>
           <td>
            Устанавливает <a href="xml.encoding.php" class="link">кодировку</a>,
            которая будет использоваться XML анализатором. По умолчанию
            используется кодировка заданная при вызове функции
            <span class="function"><a href="function.xml-parser-create.php" class="function">xml_parser_create()</a></span>. Поддерживаются кодировки
            <code class="literal">ISO-8859-1</code>, <code class="literal">US-ASCII</code> и
            <code class="literal">UTF-8</code>.
           </td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       Новое значение настройки.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xml-parser-set-option-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Возвращает <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> в случае успешного выполнения или <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в случае возникновения ошибки.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.xml-parser-set-option-errors">
  <h3 class="title">Ошибки</h3>
  <p class="para">
   Если в параметр <code class="parameter">option</code> передано недопустимое значение,
   выбрасывается исключение <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span>.
  </p>
  <p class="para">
   До PHP 8.0.0 функция возвращала значение false,
   когда отправка в параметр <code class="parameter">option</code> недопустимого значения
   приводила к ошибке уровня <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>,
   что и заставляло функцию возвращать логическое значение <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.xml-parser-set-option-changelog">
  <h3 class="title">Список изменений</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версия</th>
      <th>Описание</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.4.0</td>
      <td>
       Добавлена настройка <strong><code><a href="xml.constants.php#constant.xml-option-parse-huge">XML_OPTION_PARSE_HUGE</a></code></strong>.
      </td>
     </tr>

     <tr>
      <td>8.3.0</td>
      <td>
       Теперь параметр <code class="parameter">value</code> также принимает логические значения.
       Настройки <strong><code><a href="xml.constants.php#constant.xml-option-case-folding">XML_OPTION_CASE_FOLDING</a></code></strong> и <strong><code><a href="xml.constants.php#constant.xml-option-skip-white">XML_OPTION_SKIP_WHITE</a></code></strong>
       теперь логические.
      </td>
     </tr>

     <tr>
 <td>8.0.0</td>
 <td>
  Параметр <code class="parameter">parser</code> ожидает экземпляр класса <span class="classname"><a href="class.xmlparser.php" class="classname">XMLParser</a></span>;
  раньше параметр ждал корректный <code class="literal">xml</code>-ресурс (<span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>).
 </td>
</tr>

     <tr>
      <td>8.0.0</td>
      <td>
       Теперь выбрасывается исключение <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span>,
       если значение параметра <code class="parameter">option</code> недопустимо.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


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