cvs: phpdoc /fr/functions domxml.xml

From: Date: Thu, 22 Feb 2001 11:48:25 +0000
Subject: cvs: phpdoc /fr/functions domxml.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969334389@lists.php.net to get a copy of this message
dams Thu Feb 22 03:48:25 2001 EDT Modified files: /phpdoc/fr/functions domxml.xml Log: Updated translation due to popular demand.

Index: phpdoc/fr/functions/domxml.xml diff -u phpdoc/fr/functions/domxml.xml:1.3 phpdoc/fr/functions/domxml.xml:1.4 --- phpdoc/fr/functions/domxml.xml:1.3 Tue Jan 23 02:51:52 2001 +++ phpdoc/fr/functions/domxml.xml Thu Feb 22 03:48:25 2001 @@ -3,14 +3,31 @@ <titleabbrev>DOM XML</titleabbrev> <partintro> <simpara> + Note importante : cette documentation est en cours de r&eacute;daction, + et n'est pas encore finie. Elle souffre naturellement d'un + manque de d&eacute;tails et de relecture. Soyez en pr&eacute;venu. (Damien Seguy). + </simpara> + <simpara> Ces fonctions ne sont disponibles que si PHP a &eacute;t&eacute; configur&eacute; avec l'option <option role="configure">--with-dom=[DIR]</option>, et utilise la librairie - GNOME xml library. Vous aurez aussi besoin de la librairie libxml-2.0.0 + GNOME xml library. Vous aurez aussi besoin de la librairie libxml-2.2.7 (la version beta ne fonctionne pas). Ces fonctions ont &eacute;t&eacute; ajout&eacute;es dans PHP 4. </simpara> <simpara> + Cette extensions vous permettent de g&eacute;n&eacute;rer des documents XML avec + les API DOM. Elle fournit aussi une fonction <function>xmltree</function> + qui transforme un fichier XML en tableau PHP. Actuellement, ce + tableau est accessible uniquement en lecture. Cela ne siginifie pas + que vous ne pouvez pas le modifier, mais cela n'aurait aucun sens + car <function>dumpmem</function> ne pourra pas prendre ces modifications + en consid&eacute;ration. Par cons&eacute;quent, si vous voulez lire un fichier XML + et &eacute;crire sa version modifi&eacute;e, utilisez les fonctions + <function>add_node</function>, <function>set_attribute</function>, etc... + et finalement, <function>dumpmem</function>. + </simpara> + <simpara> Ce module d&eacute;finit les constantes suivantes : </simpara> <table> @@ -20,24 +37,24 @@ <row> <entry>Constante</entry> <entry>Valeur</entry> - <entry>D&eacute;scription</entry> + <entry>Description</entry> </row> </thead> <tbody> <row> <entry>XML_ELEMENT_NODE</entry> <entry>1</entry> - <entry></entry> + <entry>Le noeud est un &eacute;l&eacute;ment</entry> </row> <row> <entry>XML_ATTRIBUTE_NODE</entry> <entry>2</entry> - <entry></entry> + <entry>Le noeud est un attribut</entry> </row> <row> <entry>XML_TEXT_NODE</entry> <entry>3</entry> - <entry></entry> + <entry>Le noeud est un texte</entry> </row> <row> <entry>XML_CDATA_SECTION_NODE</entry> @@ -52,22 +69,22 @@ <row> <entry>XML_ENTITY_NODE</entry> <entry>6</entry> - <entry></entry> + <entry>Le noeud est une entit&eacute;e telle que &amp;nbsp;</entry> </row> <row> <entry>XML_PI_NODE</entry> <entry>7</entry> - <entry></entry> + <entry>Le noeud est une instruction</entry> </row> <row> <entry>XML_COMMENT_NODE</entry> <entry>8</entry> - <entry></entry> + <entry>Le noeud est un commentaire</entry> </row> <row> <entry>XML_DOCUMENT_NODE</entry> <entry>9</entry> - <entry></entry> + <entry>Le noeud est un document</entry> </row> <row> <entry>XML_DOCUMENT_TYPE_NODE</entry> @@ -97,11 +114,234 @@ </tbody> </tgroup> </table> + <simpara> + Chaque fonction de cette extension peut &ecirc;tre utilis&eacute;e de deux mani&egrave;res + diff&eacute;rentes. Dans un contexte proc&eacute;dural, il faut passer l'objet en + premier argument; dans un contexte objet, vous pouvez appeler la + fonction comme une m&eacute;thode de cet objet. Cette documentation pr&eacute;sente + les fonctions dans leur contexte proc&eacute;dural. Vous pouvez conna&icirc;tre la + m&eacute;thode objet en supprimant le pr&eacute;fixe "<literal>domxml_</literal>". + Les tables suivantes listes toutes les classes, leurs attributs et + leurs m&eacute;thodes. + </simpara> <simpara> - Ce module d&eacute;finit un ensemble de classes. Les fonctions DOM XML - retourne un arbre &agrave; partir d'un document XML, dont chaque noeud - est un objet issu de ces classes. + Ce module d&eacute;finit un ensemble de classes, qui sont list&eacute;es + ci-dessous (y compris leur attributs et leur m&eacute;thodes). </simpara> + <para> + <table> + <title>classe DomDocument (m&eacute;thodes)</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Nom de la m&eacute;thode</entry> + <entry>Nom de la fonction</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>root</entry> + <entry><function>domxml_root</function></entry> + <entry></entry> + </row> + <row> + <entry>children</entry> + <entry><function>domxml_children</function></entry> + <entry></entry> + </row> + <row> + <entry>add_root</entry> + <entry><function>domxml_add_root</function></entry> + <entry></entry> + </row> + <row> + <entry>dtd</entry> + <entry><function>domxml_intdtd</function></entry> + <entry></entry> + </row> + <row> + <entry>dumpmem</entry> + <entry><function>domxml</function></entry> + <entry></entry> + </row> + <row> + <entry>xpath_init</entry> + <entry>xpath_init</entry> + <entry></entry> + </row> + <row> + <entry>xpath_new_context</entry> + <entry>xpath_new_context</entry> + <entry></entry> + </row> + <row> + <entry>xptr_new_context</entry> + <entry>xptr_new_context</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <table> + <title>Classe DomDocument (attributs)</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Nom</entry> + <entry>Type</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>doc</entry> + <entry>class DomDocument</entry> + <entry>L'objet lui-m&ecirc;me</entry> + </row> + <row> + <entry>name</entry> + <entry>string</entry> + <entry></entry> + </row> + <row> + <entry>url</entry> + <entry>string</entry> + <entry></entry> + </row> + <row> + <entry>version</entry> + <entry>string</entry> + <entry>Version de XML</entry> + </row> + <row> + <entry>encoding</entry> + <entry>string</entry> + <entry></entry> + </row> + <row> + <entry>standalone</entry> + <entry>long</entry> + <entry>1 si le fichier est complet</entry> + </row> + <row> + <entry>type</entry> + <entry>long</entry> + <entry>Une des constantes de la table ... </entry> + </row> + <row> + <entry>compression</entry> + <entry>long</entry> + <entry>1 si le fichier est compress&eacute;</entry> + </row> + <row> + <entry>charset</entry> + <entry>long</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <table> + <title>classe DomNode (m&eacute;thodes)</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Nom</entry> + <entry>Nom en PHP</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>lastchild</entry> + <entry><function>domxml_last_child</function></entry> + <entry></entry> + </row> + <row> + <entry>children</entry> + <entry><function>domxml_children</function></entry> + <entry></entry> + </row> + <row> + <entry>parent</entry> + <entry><function>domxml_parent</function></entry> + <entry></entry> + </row> + <row> + <entry>new_child</entry> + <entry><function>domxml_new_child</function></entry> + <entry></entry> + </row> + <row> + <entry>get_attribute</entry> + <entry><function>domxml_get_attribute</function></entry> + <entry></entry> + </row> + <row> + <entry>set_attribute</entry> + <entry><function>domxml_set_attribute</function></entry> + <entry></entry> + </row> + <row> + <entry>attributes</entry> + <entry><function>domxml_attributes</function></entry> + <entry></entry> + </row> + <row> + <entry>node</entry> + <entry><function>domxml_node</function></entry> + <entry></entry> + </row> + <row> + <entry><function>set_content</function></entry> + <entry>domxml_set_content</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <table> + <title>classe DomNode (attributs)</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Nom</entry> + <entry>Type</entry> + <entry>Description</entry> + </row> + </thead> + <tbody> + <row> + <entry>node</entry> + <entry>class DomNode</entry> + <entry>L'objet lui-m&ecirc;me</entry> + </row> + <row> + <entry>type</entry> + <entry>long</entry> + <entry></entry> + </row> + <row> + <entry>name</entry> + <entry>string</entry> + <entry></entry> + </row> + <row> + <entry>content</entry> + <entry>string</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </para> </partintro> <!-- class Dom document --> <!-- has member functions @@ -215,37 +455,357 @@ <para> <function>xmltree</function> analyse le document XML <parameter>str</parameter> et retourne un arbre d'objets PHP qui repr&eacute;sente le document - analys&eacute;. + analys&eacute;. <function>xmltree</function> est diff&eacute;rentes des autres + fonctions, car vous ne pouvez acc&eacute;der &agrave; cet arbre avec aucune des + autres fonctions. Modifier cet arbre n'a pas de sens, car il n'y + a pas moyen de sauver ces modifications. Cette fonction a tout de + m&ecirc;me des applications en lecture seule. + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_root"> + <refnamediv> + <refname>domxml_root</refname> + <refpurpose> + Retourne l'&eacute;l&eacute;ment racine + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>domxml_root</function></funcdef> + <paramdef>array <parameter>doc</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_root</function> retourne l'&eacute;l&eacute;ment qui est + plac&eacute; tout en haut du document XML. En fait, il existe aussi + des commentaires qui peuvent &ecirc;tre plac&eacute;s l&agrave;, mais ils + sont actuellement ignor&eacute;s. + </para> + <para> + L'exemple suivant retourne simplement l'&eacute;l&eacute;ment CHAPTER et + l'affiche. Les autres racines (des commentaires) ne sont + pas retourn&eacute;s. + <example> + <title>Lecture de l'&eacute;l&eacute;ment principal</title> + <programlisting> +&lt;?php +$xmlstr = "&lt;?xml version='1.0' standalone='yes'??&gt; +&lt;!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd' +[ &lt;!ENTITY sp \"spanish\"?&gt; +]?&gt; +&lt;!-- lsfj --?&gt; +&lt;chapter language='en'?&gt;&lt;title language='en'?&gt;Title&lt;/title?&gt; + &lt;para language='ge'?&gt; + &amp;sp; + &lt;!-- comment --?&gt; + &lt;informaltable language='&amp;sp;'?&gt; + &lt;tgroup cols='3'?&gt; + &lt;tbody?&gt; + &lt;row?&gt;&lt;entry?&gt;a1&lt;/entry?&gt;&lt;entry +morerows='1'?&gt;b1&lt;/entry?&gt;&lt;entry?&gt;c1&lt;/entry?&gt;&lt;/row?&gt; +&lt;row?&gt;&lt;entry?&gt;a2&lt;/entry?&gt;&lt;entry?&gt;c2&lt;/entry?&gt;&lt;/row?&gt; + &lt;row?&gt;&lt;entry?&gt;a3&lt;/entry?&gt;&lt;entry?&gt;b3&lt;/entry?&gt;&lt;entry?&gt;c3&lt;/entry?&gt;&lt;/row?&gt; + &lt;/tbody?&gt; + &lt;/tgroup?&gt; + &lt;/informaltable?&gt; + &lt;/para?&gt; +&lt;/chapter?&gt;"; +if(!$dom = xmldoc($xmlstr)) { + echo "Error while parsing the document\n"; + exit; +} +$root = $dom-?&gt;root(); +print_r($root); +??&gt; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_add_root"> + <refnamediv> + <refname>domxml_add_root</refname> + <refpurpose> + Ajoute une autre racine + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>resource <function>domxml_add_root</function></funcdef> + <paramdef>resource <parameter>doc</parameter></paramdef> + <paramdef>string <parameter>name</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_add_root</function> ajoute la racine <parameter>name</parameter> + au document <parameter>doc</parameter>. + </para> + <para> + <example> + <title>Cr&eacute;ation d'un ent&ecirc;te HTML simple</title> + <programlisting> +&lt;?php +$doc = new_xmldoc("1.0"); +$root = $doc-?&gt;add_root("HTML"); +$head = $root-?&gt;new_child("HEAD", ""); +$head-?&gt;new_child("TITLE", "Hier der Titel"); +echo $doc-?&gt;dumpmem(); +??&gt; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_dumpmem"> + <refnamediv> + <refname>domxml_dumpmem</refname> + <refpurpose> + Ecrit le document XML interne dans une cha&icirc;ne + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>domxml_dumpmem</function></funcdef> + <paramdef>resource <parameter>doc</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_dumpmem</function> cr&eacute;e un document XML &agrave; partir + de la repr&eacute;sentation interne. <function>domxml_dumpmem</function> + est g&eacute;n&eacute;ralement appel&eacute;e avec avoir construit un nouveau document + XML, comme dans l'exemple <function>domxml_add_root</function>. + </para> + <para> + Voir aussi<function>domxml_add_root</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_attributes"> + <refnamediv> + <refname>domxml_attributes</refname> + <refpurpose> + Retourne les attributs d'un noeud + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>domxml_attributes</function></funcdef> + <paramdef>resource <parameter>node</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_attributes</function> retourne tous les + attributs du noeud <parameter>node</parameter> sous forme + d'un tableau d'objets "dom attribute". + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_get_attribute"> + <refnamediv> + <refname>domxml_get_attribute</refname> + <refpurpose> + Retourne un attribut d'un noeud + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>domxml_get_attribute</function></funcdef> + <paramdef>resource <parameter>node</parameter></paramdef> + <paramdef>string <parameter>name</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_get_attribute</function> retourn l'attribut + <parameter>name</parameter> du noeud <parameter>node</parameter>. + </para> + <simpara> + Voir aussi <function>domxml_set_attribute</function>. + </simpara> + </refsect1> + </refentry> + <refentry id="function.domxml_set_attribute"> + <refnamediv> + <refname>domxml_set_attribute</refname> + <refpurpose> + Modifie un attribut + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>domxml_set_attribute</function></funcdef> + <paramdef>resource <parameter>node</parameter></paramdef> + <paramdef>string <parameter>name</parameter></paramdef> + <paramdef>string <parameter>value</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_set_attribute</function> modifie l'attribut + <parameter>name</parameter> du noeud <parameter>node</parameter> + en lui attribuant la valeur <parameter>value</parameter>. + </para> + <para> + En partant de l'exemple propos&eacute; &agrave; la fonction <function>domxml_add_root</function>, + il est simple d'ajouter un attribut &agrave; l'&eacute;l&eacute;ment HEAD en + appelant simplement <function>set_attribute</function>. + <example> + <title>Adding an attribute to an element</title> + <programlisting> +&lt;?php +$doc = new_xmldoc("1.0"); +$root = $doc-&gt;add_root("HTML"); +$head = $root-&gt;new_child("HEAD", ""); +$head-&gt;new_child("TITLE", "Ici, le titre"); +$head-&gt;set_attribute("Language", "fr"); +$head-&gt;new_child("TITLE", "Hier der Titel"); +$head-&gt;set_attribute("Language", "ge"); +echo $doc-&gt;dumpmem(); +?&gt; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_children"> + <refnamediv> + <refname>domxml_children</refname> + <refpurpose> + Retourne les fils d'un noeud + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>domxml_children</function></funcdef> + <paramdef>object <parameter>doc|node</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_children</function> retourne tous les fils + du noeud <parameter>doc|node</parameter>, sous forme d'un tableau + de noeuds. + </para> + <para> + Dans l'exemple ci-dessous, la variable <varname>children</varname> + contiendra un tableau avec les noeuds de type XML_ELEMENT. Ce noeud est + l'&eacute;l&eacute;ment TITLE. + <example> + <title>Lire les fils d'un noeud</title> + <programlisting> +&lt;?php +$doc = new_xmldoc("1.0"); +$root = $doc-&gt;add_root("HTML"); +$head = $root-&gt;new_child("HEAD", ""); +$head-&gt;new_child("TITLE", "Hier der Titel"); +$head-&gt;set_attribute("Language", "ge"); +$children = $head-&gt;children() +?&gt; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_new_child"> + <refnamediv> + <refname>domxml_new_child</refname> + <refpurpose> + Ajoute un nouveau fils + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>resource <function>domxml_new_child</function></funcdef> + <paramdef>string <parameter>name</parameter></paramdef> + <paramdef>string <parameter>content</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_new_child</function> ajoute un nouveau fils. + (NDtraducteur : cette doc n'est pas encore finie...) + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_new_xmldoc"> + <refnamediv> + <refname>domxml_new_xmldoc</refname> + <refpurpose> + Cr&eacute;e un document XML vide + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>domxml_new_xmldoc</function></funcdef> + <paramdef>string <parameter>version</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + <function>domxml_new_xmldoc</function> cr&eacute;e un nouveau + document XML vide, et le retourne. + </para> + <para> + Voir aussi <function>domxml_add_root</function>. + </para> + </refsect1> + </refentry> + <refentry id="function.xpath_new_context"> + <refnamediv> + <refname>xpath_new_context</refname> + <refpurpose> + Cr&eacute;e un nouveau contexte xpath + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>object <function>xpath_new_context</function></funcdef> + <paramdef>object <parameter>dom document</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + </para> + <para> + Pas de doc encore (22/2/2201). + </para> + </refsect1> + </refentry> + <refentry id="function.xpath_eval"> + <refnamediv> + <refname>xpath_eval</refname> + <refpurpose> + Evalue une expression xpath + </refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcprototype> + <funcdef>array <function>xpath_eval</function></funcdef> + <paramdef>object <parameter>xpath context</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + </para> + <para> + Pas de doc encore (22/2/2201). </para> </refsect1> </refentry> - </reference> -<!-- - TODO - domxml_root - domxml_add_root - domxml_dumpmem - domxml_attributes - domxml_getattr - domxml_setattr - domxml_children - domxml_new_child - domxml_node - domxml_new_xmldoc alias new_xmldoc ---> -<!-- 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 -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: ---> + </reference> \ No newline at end of file
« previous php.doc (#969334389) next »