1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
Mikhail Alferov afd96f2d1a Update c1f37a6 to En (#1094)
* Update basic.xml to en

* Update properties.xml to en

* Update traits.xml to En

* Update visibility.xml to en

* Update book.xml to en

* Update book.xml to en + infostyle

* Update mb-convert-encoding.xml to en

* Update book.xml to en

* Update mb-convert-encoding.xml nit

* Update preg-replace-callback.xml to en + infostyle

* Update preg-replace-callback.xml to en actually

* Update book.xml to en

* Update simplexml-load-file.xml to en + infostyle

* Update addAttribute.xml to en

* Update addChild.xml to en

* Update construct.xml to en

* Update getName.xml to en

* Update book.xml to en

* Update xml-parse.xml to en + infostyle

* Update book.xml to en

* Update isvalid.xml to en

* Update book.xml to en
2025-07-29 02:53:50 +03:00

178 lines
5.3 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: c1f37a6c270aadbbb3da56a3973ffd62197adf2b Maintainer: mch Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="simplexmlelement.addattribute" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SimpleXMLElement::addAttribute</refname>
<refpurpose>
Добавляет атрибут к SimpleXML-элементу
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="SimpleXMLElement">
<modifier>public</modifier> <type>void</type><methodname>SimpleXMLElement::addAttribute</methodname>
<methodparam><type>string</type><parameter>qualifiedName</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>namespace</parameter><initializer>&null;</initializer></methodparam>
</methodsynopsis>
<para>
Метод добавляет атрибут к SimpleXML-элементу.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>qualifiedName</parameter></term>
<listitem>
<para>
Название атрибута, который требуется добавить.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
Значение атрибута.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>namespace</parameter></term>
<listitem>
<para>
Необязательный параметр указывает на пространство
имён, которому принадлежит атрибут.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<note>
<para>
В следующем примере включается файл <literal>examples/simplexml-data.php</literal>
с определением XML-строки из первого примера руководства
«<link linkend="simplexml.examples-basic">Основы работы с модулем SimpleXML</link>».
</para>
</note>
<example>
<title>Пример добавления атрибутов и потомков к SimpleXML-элементу</title>
<programlisting role="php">
<![CDATA[
<?php
include 'examples/simplexml-data.php';
$sxe = new SimpleXMLElement($xmlstr);
$sxe->addAttribute('type', 'documentary');
$movie = $sxe->addChild('movie');
$movie->addChild('title', 'PHP2: Устройство парсера');
$movie->addChild('plot', 'Только люди заставляют парсер работать.');
$characters = $movie->addChild('characters');
$character = $characters->addChild('character');
$character->addChild('name', 'Mr. Parser');
$character->addChild('actor', 'John Doe');
$rating = $movie->addChild('rating', '5');
$rating->addAttribute('type', 'stars');
echo $sxe->asXML();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
<?xml version="1.0" standalone="yes"?>
<movies type="documentary">
<movie>
<title>PHP: Устройство парсера</title>
<characters>
<character>
<name>Ms. Coder</name>
<actor>Onlivia Actora</actor>
</character>
<character>
<name>Mr. Coder</name>
<actor>El Act&#xD3;r</actor>
</character>
</characters>
<plot>
Так что же, PHP — язык программирования или всё же скриптовый язык?
Истина откроется в этом захватывающем пародийном фильме ужасов
в формате документальной драмы.
</plot>
<great-lines>
<line>Каких только веб-задач не решает PHP!</line>
</great-lines>
<rating type="thumbs">7</rating>
<rating type="stars">5</rating>
</movie>
<movie>
<title>PHP2: Устройство парсера</title>
<plot>Только люди заставляют парсер работать.</plot>
<characters>
<character>
<name>Mr. Parser</name>
<actor>John Doe</actor>
</character>
</characters>
<rating type="stars">5</rating>
</movie>
</movies>
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>SimpleXMLElement::addChild</methodname></member>
<member><xref linkend="simplexml.examples-basic"/></member>
</simplelist>
</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
-->