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édaction, + et n'est pas encore finie. Elle souffre naturellement d'un + manque de détails et de relecture. Soyez en prévenu. (Damien Seguy). + </simpara> + <simpara> Ces fonctions ne sont disponibles que si PHP a été configuré 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 été ajoutées dans PHP 4. </simpara> <simpara> + Cette extensions vous permettent de géné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ération. Par conséquent, si vous voulez lire un fichier XML + et écrire sa version modifiée, utilisez les fonctions + <function>add_node</function>, <function>set_attribute</function>, etc... + et finalement, <function>dumpmem</function>. + </simpara> + <simpara> Ce module définit les constantes suivantes : </simpara> <table> @@ -20,24 +37,24 @@ <row> <entry>Constante</entry> <entry>Valeur</entry> - <entry>Déscription</entry> + <entry>Description</entry> </row> </thead> <tbody> <row> <entry>XML_ELEMENT_NODE</entry> <entry>1</entry> - <entry></entry> + <entry>Le noeud est un élé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ée telle que &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 être utilisée de deux +manières + différentes. Dans un contexte procédural, il faut passer l'objet en + premier argument; dans un contexte objet, vous pouvez appeler la + fonction comme une méthode de cet objet. Cette documentation +présente + les fonctions dans leur contexte procédural. Vous pouvez connaître la + méthode objet en supprimant le préfixe "<literal>domxml_</literal>". + Les tables suivantes listes toutes les classes, leurs attributs et + leurs méthodes. + </simpara> <simpara> - Ce module définit un ensemble de classes. Les fonctions DOM XML - retourne un arbre à partir d'un document XML, dont chaque noeud - est un objet issu de ces classes. + Ce module définit un ensemble de classes, qui sont listées + ci-dessous (y compris leur attributs et leur méthodes). </simpara> + <para> + <table> + <title>classe DomDocument (méthodes)</title> + <tgroup cols="3"> + <thead> + <row> + <entry>Nom de la mé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ê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é</entry> + </row> + <row> + <entry>charset</entry> + <entry>long</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <table> + <title>classe DomNode (mé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ê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ésente le document - analysé. + analysé. <function>xmltree</function> est différentes des autres + fonctions, car vous ne pouvez accéder à 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ême des applications en lecture seule. + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_root"> + <refnamediv> + <refname>domxml_root</refname> + <refpurpose> + Retourne l'élé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'élément qui est + placé tout en haut du document XML. En fait, il existe aussi + des commentaires qui peuvent être placés là, mais ils + sont actuellement ignorés. + </para> + <para> + L'exemple suivant retourne simplement l'élément CHAPTER et + l'affiche. Les autres racines (des commentaires) ne sont + pas retournés. + <example> + <title>Lecture de l'élément principal</title> + <programlisting> +<?php +$xmlstr = "<?xml version='1.0' standalone='yes'??> +<!DOCTYPE chapter SYSTEM '/share/sgml/Norman_Walsh/db3xml10/db3xml10.dtd' +[ <!ENTITY sp \"spanish\"?> +]?> +<!-- lsfj --?> +<chapter language='en'?><title language='en'?>Title</title?> + <para language='ge'?> + &sp; + <!-- comment --?> + <informaltable language='&sp;'?> + <tgroup cols='3'?> + <tbody?> + <row?><entry?>a1</entry?><entry +morerows='1'?>b1</entry?><entry?>c1</entry?></row?> +<row?><entry?>a2</entry?><entry?>c2</entry?></row?> + +<row?><entry?>a3</entry?><entry?>b3</entry?><entry?>c3</entry?></row?> + </tbody?> + </tgroup?> + </informaltable?> + </para?> +</chapter?>"; +if(!$dom = xmldoc($xmlstr)) { + echo "Error while parsing the document\n"; + exit; +} +$root = $dom-?>root(); +print_r($root); +??> + </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éation d'un entête HTML simple</title> + <programlisting> +<?php +$doc = new_xmldoc("1.0"); +$root = $doc-?>add_root("HTML"); +$head = $root-?>new_child("HEAD", ""); +$head-?>new_child("TITLE", "Hier der Titel"); +echo $doc-?>dumpmem(); +??> + </programlisting> + </example> + </para> + </refsect1> + </refentry> + <refentry id="function.domxml_dumpmem"> + <refnamediv> + <refname>domxml_dumpmem</refname> + <refpurpose> + Ecrit le document XML interne dans une chaî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ée un document XML à partir + de la représentation interne. <function>domxml_dumpmem</function> + est généralement appelé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é à la fonction +<function>domxml_add_root</function>, + il est simple d'ajouter un attribut à l'élément HEAD en + appelant simplement <function>set_attribute</function>. + <example> + <title>Adding an attribute to an element</title> + <programlisting> +<?php +$doc = new_xmldoc("1.0"); +$root = $doc->add_root("HTML"); +$head = $root->new_child("HEAD", ""); +$head->new_child("TITLE", "Ici, le titre"); +$head->set_attribute("Language", "fr"); +$head->new_child("TITLE", "Hier der Titel"); +$head->set_attribute("Language", "ge"); +echo $doc->dumpmem(); +?> + </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'élément TITLE. + <example> + <title>Lire les fils d'un noeud</title> + <programlisting> +<?php +$doc = new_xmldoc("1.0"); +$root = $doc->add_root("HTML"); +$head = $root->new_child("HEAD", ""); +$head->new_child("TITLE", "Hier der Titel"); +$head->set_attribute("Language", "ge"); +$children = $head->children() +?> + </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é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é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é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