mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
initial documentation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@166168 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
fa2e38785e
commit
fb37dcd3a9
1 changed files with 78 additions and 0 deletions
78
reference/dom/functions/dom-import-simplexml.xml
Normal file
78
reference/dom/functions/dom-import-simplexml.xml
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id='function.dom-import-simplexml'>
|
||||
<refnamediv>
|
||||
<refname>dom_import_SimpleXML</refname>
|
||||
<refpurpose>
|
||||
Get a <classname>DOM</classname> object from a
|
||||
<classname>SimpleXMLElement</classname> object
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>object DOMElement</type><methodname>dom_import_simplexml</methodname>
|
||||
<methodparam><type>SimpleXMLElement</type><parameter>node</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function takes a node of a <link linkend="ref.simplexml">SimpleXML</link>
|
||||
Object and makes it into a DOMElement node. This new object can
|
||||
then be used as a native DOM 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">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$sxe = simplexml_load_string('<books><book><title>blah</title></book></books>');
|
||||
if ($sxe === false) {
|
||||
echo 'Error while parsing the document';
|
||||
exit;
|
||||
}
|
||||
|
||||
$dom_sxe = dom_import_simplexml($sxe);
|
||||
if (!$dom_sxe) {
|
||||
echo 'Error while converting XML';
|
||||
exit;
|
||||
}
|
||||
|
||||
var_dump($dom_sxe);
|
||||
|
||||
$dom = new domdocument("1.0");
|
||||
var_dump($dom);
|
||||
$dom_sxe = $dom->importnode($dom_sxe, true);
|
||||
$dom_sxe = $dom->appendchild($dom_sxe);
|
||||
|
||||
echo $dom->savexml();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<function>simplexml_import_dom</function>.
|
||||
</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:"../../../../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
|
||||
-->
|
Loading…
Reference in a new issue