Files
doc-fr/reference/simplexml/functions/simplexml-element-xpath.xml
Damien Seguy b0a8b9eeee minor spelling mistakes
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@260356 c90b9560-bf6c-de11-be94-00142212c4b1
2008-05-27 11:18:36 +00:00

125 lines
2.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- EN-Revision: 1.9 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<refentry xml:id='function.simplexml-element-xpath' xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SimpleXMLElement->xpath()</refname>
<refpurpose>Exécute une requête Xpath sur des données XML</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>SimpleXMLElement</classname></ooclass>
<methodsynopsis>
<type>array</type><methodname>xpath</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
La méthode <literal>xpath</literal> cherche dans le noeud SimpleXML des
enfants qui correspondent au <parameter>path</parameter>
<acronym>Xpath</acronym>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
Un chemin XPath
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne un tableau d'objets SimpleXMLElement ou &false; si une erreur survient.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Xpath</title>
<programlisting role="php">
<![CDATA[
<?php
$string = <<<XML
<a>
<b>
<c>text</c>
<c>stuff</c>
</b>
<d>
<c>code</c>
</d>
</a>
XML;
$xml = new SimpleXMLElement($string);
/* On cherche <a><b><c> */
$result = $xml->xpath('/a/b/c');
while(list( , $node) = each($result)) {
echo '/a/b/c: ',$node,"\n";
}
/* Les chemins relatifs fonctionnent aussi... */
$result = $xml->xpath('b/c');
while(list( , $node) = each($result)) {
echo 'b/c: ',$node,"\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
/a/b/c: text
/a/b/c: stuff
b/c: text
b/c: stuff
]]>
</screen>
<simpara>
Notez que les deux résultats sont égaux.
</simpara>
</example>
</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
-->