|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: pastore Status: ready --> |
| 3 | +<!-- CREDITS: darvina --> |
| 4 | +<refentry xml:id='function.dom-import-simplexml' xmlns="http://docbook.org/ns/docbook"> |
| 5 | + <refnamediv> |
| 6 | + <refname>dom_import_simplexml</refname> |
| 7 | + <refpurpose> |
| 8 | + Ottiene un oggetto <classname>DOMElement</classname> da un |
| 9 | + oggetto <classname>SimpleXMLElement</classname> |
| 10 | + </refpurpose> |
| 11 | + </refnamediv> |
| 12 | + <refsect1 role="description"> |
| 13 | + &reftitle.description; |
| 14 | + <methodsynopsis> |
| 15 | + <type>DOMElement</type><methodname>dom_import_simplexml</methodname> |
| 16 | + <methodparam><type>SimpleXMLElement</type><parameter>node</parameter></methodparam> |
| 17 | + </methodsynopsis> |
| 18 | + <para> |
| 19 | + Questa funzione prende il nodo <parameter>node</parameter> della classe |
| 20 | + <link linkend="ref.simplexml">SimpleXML</link> e lo rende un nodo |
| 21 | + <classname>DOMElement</classname>. Dopo questo nuovo oggetto può essere usato |
| 22 | + come un nodo nativo <classname>DOMElement</classname>. |
| 23 | + </para> |
| 24 | + </refsect1> |
| 25 | + <refsect1 role="parameters"> |
| 26 | + &reftitle.parameters; |
| 27 | + <para> |
| 28 | + <variablelist> |
| 29 | + <varlistentry> |
| 30 | + <term><parameter>node</parameter></term> |
| 31 | + <listitem> |
| 32 | + <para> |
| 33 | + Il nodo <classname>SimpleXMLElement</classname>. |
| 34 | + </para> |
| 35 | + </listitem> |
| 36 | + </varlistentry> |
| 37 | + </variablelist> |
| 38 | + </para> |
| 39 | + </refsect1> |
| 40 | + <refsect1 role="returnvalues"> |
| 41 | + &reftitle.returnvalues; |
| 42 | + <para> |
| 43 | + Il nodo <classname>DOMElement</classname> aggiunto o &false; se si verificano errori. |
| 44 | + </para> |
| 45 | + </refsect1> |
| 46 | + <refsect1 role="examples"> |
| 47 | + &reftitle.examples; |
| 48 | + <example> |
| 49 | + <title>Importare SimpleXML nel DOM con <function>dom_import_simplexml</function></title> |
| 50 | + <programlisting role="php"> |
| 51 | +<![CDATA[ |
| 52 | +<?php |
| 53 | +
|
| 54 | +$sxe = simplexml_load_string('<books><book><title>blah</title></book></books>'); |
| 55 | +
|
| 56 | +if ($sxe === false) { |
| 57 | + echo 'Error while parsing the document'; |
| 58 | + exit; |
| 59 | +} |
| 60 | +
|
| 61 | +$dom_sxe = dom_import_simplexml($sxe); |
| 62 | +if (!$dom_sxe) { |
| 63 | + echo 'Error while converting XML'; |
| 64 | + exit; |
| 65 | +} |
| 66 | +
|
| 67 | +$dom = new DOMDocument('1.0'); |
| 68 | +$dom_sxe = $dom->importNode($dom_sxe, true); |
| 69 | +$dom_sxe = $dom->appendChild($dom_sxe); |
| 70 | +
|
| 71 | +echo $dom->saveXML(); |
| 72 | +
|
| 73 | +?> |
| 74 | +]]> |
| 75 | + </programlisting> |
| 76 | + </example> |
| 77 | + </refsect1> |
| 78 | + <refsect1 role="seealso"> |
| 79 | + &reftitle.seealso; |
| 80 | + <para> |
| 81 | + <simplelist> |
| 82 | + <member><function>simplexml_import_dom</function></member> |
| 83 | + </simplelist> |
| 84 | + </para> |
| 85 | + </refsect1> |
| 86 | +</refentry> |
| 87 | + |
| 88 | +<!-- Keep this comment at the end of the file |
| 89 | +Local variables: |
| 90 | +mode: sgml |
| 91 | +sgml-omittag:t |
| 92 | +sgml-shorttag:t |
| 93 | +sgml-minimize-attributes:nil |
| 94 | +sgml-always-quote-attributes:t |
| 95 | +sgml-indent-step:1 |
| 96 | +sgml-indent-data:t |
| 97 | +indent-tabs-mode:nil |
| 98 | +sgml-parent-document:nil |
| 99 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 100 | +sgml-exposed-tags:nil |
| 101 | +sgml-local-catalogs:nil |
| 102 | +sgml-local-ecat-files:nil |
| 103 | +End: |
| 104 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 105 | +vim: et tw=78 syn=sgml |
| 106 | +vi: ts=1 sw=1 |
| 107 | +--> |
0 commit comments