mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
forgot to commit dom_import_simplexml.xml in previous commit, this file is finalized
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@175211 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d6172ae71d
commit
360c9579f8
1 changed files with 66 additions and 37 deletions
|
@ -1,32 +1,56 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<refentry id='function.dom-import-simplexml'>
|
||||
<refnamediv>
|
||||
<refname>dom_import_simplexml</refname>
|
||||
<refpurpose>
|
||||
Get a <classname>DOMElement</classname> object from a
|
||||
<classname>SimpleXMLElement</classname> object
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>DOMElement</type><methodname>dom_import_simplexml</methodname>
|
||||
<methodparam><type>SimpleXMLElement</type><parameter>node</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function takes the node <parameter>node</parameter>
|
||||
of class <link linkend="ref.simplexml">SimpleXML</link>
|
||||
and makes it into a <classname>DOMElement</classname> node. This new object can
|
||||
then be used as a native <classname>DOMElement</classname> node.
|
||||
If any errors occur, it returns &false;.
|
||||
</para>
|
||||
<example>
|
||||
<title>Import SimpleXML into DOM with <methodname>dom_import_simplexml</methodname></title>
|
||||
<programlisting role="php">
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<refentry id='function.dom-import-simplexml'>
|
||||
<refnamediv>
|
||||
<refname>dom_import_simplexml</refname>
|
||||
<refpurpose>
|
||||
Gets a DOMElement object from a SimpleXMLElement object
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<type>DOMElement</type><methodname>dom_import_simplexml</methodname>
|
||||
<methodparam><type>SimpleXMLElement</type><parameter>node</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function takes the node <parameter>node</parameter> of class
|
||||
<link linkend="ref.simplexml">SimpleXML</link> and makes it into a
|
||||
<classname>DOMElement</classname> node. This new object can then be used
|
||||
as a native <classname>DOMElement</classname> node.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>node</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <classname>SimpleXMLElement</classname> node.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
The DOMElement node added or &false; if any errors occur.
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title>Import SimpleXML into DOM with <function>dom_import_simplexml</function></title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$sxe = simplexml_load_string('<books><book><title>blah</title></book></books>');
|
||||
|
||||
if ($sxe === false) {
|
||||
echo 'Error while parsing the document';
|
||||
exit;
|
||||
|
@ -38,21 +62,26 @@ if (!$dom_sxe) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$dom = new domdocument("1.0");
|
||||
$dom_sxe = $dom->importnode($dom_sxe, true);
|
||||
$dom_sxe = $dom->appendchild($dom_sxe);
|
||||
$dom = new DOMDocument('1.0');
|
||||
$dom_sxe = $dom->importNode($dom_sxe, true);
|
||||
$dom_sxe = $dom->appendChild($dom_sxe);
|
||||
|
||||
echo $dom->saveXML();
|
||||
|
||||
echo $dom->savexml();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<function>simplexml_import_dom</function>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>simplexml_import_dom</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
|
Loading…
Reference in a new issue