Files
php-doc-ru/reference/dom/functions/dom-ns-import-simplexml.xml
2024-12-15 18:10:32 +03:00

95 lines
3.1 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: c82f29b65c2cf108e7ade2c5558af0de5cc64b53 Maintainer: sergey Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.dom-ns-import-simplexml" xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude">
<refnamediv>
<refname>Dom\import_simplexml</refname>
<refpurpose>
Получает объект класса <classname>Dom\Attr</classname> или <classname>Dom\Element</classname>
из объекта <classname>SimpleXMLElement</classname>
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>Dom\Attr</type><type>Dom\Element</type></type><methodname>Dom\import_simplexml</methodname>
<methodparam><type>object</type><parameter>node</parameter></methodparam>
</methodsynopsis>
<simpara>
Функция принимает заданный атрибут или элемент <parameter>node</parameter>
(экземпляр <classname>SimpleXMLElement</classname>) и создаёт узел <classname>Dom\Attr</classname>
или <classname>Dom\Element</classname>, соответственно.
Новый узел <classname>Dom\Node</classname> ссылается на тот же базовый узел XML,
что и <classname>SimpleXMLElement</classname>.
</simpara>
</refsect1>
<refsect1 role="parameters">
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('function.dom-import-simplexml')/db:refsect1[@role='parameters']/*)">
<xi:fallback/>
</xi:include>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Функция возвращает объект класса <classname>Dom\Attr</classname> или <classname>Dom\Element</classname>.
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Импорт SimpleXML в DOM и изменение SimpleXML с помощью DOM</title>
<simpara>
Обработка ошибок опущена для краткости.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
$sxe = simplexml_load_string('<books><book><title>blah</title></book></books>');
$elt = Dom\import_simplexml($sxe);
$elt->setAttribute("foo", "bar");
echo $sxe->asXML();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<?xml version="1.0"?>
<books foo="bar"><book><title>blah</title></book></books>
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>simplexml_import_dom</function></member>
</simplelist>
</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
-->