1
0
mirror of https://github.com/php/doc-de.git synced 2026-03-28 09:12:16 +01:00
Files
archived-doc-de/reference/simplexml/functions/simplexml-element-xpath.xml
Carola 'Sammy' Kummert 504c8f9ccc updated to current english versions
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@215096 c90b9560-bf6c-de11-be94-00142212c4b1
2006-06-20 10:57:09 +00:00

101 lines
2.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- EN-Revision: 1.5 Maintainer: sammywg Status: ready -->
<refentry id='function.simplexml-element-xpath'>
<refnamediv>
<refname>SimpleXMLElement->xpath()</refname>
<refpurpose>
Führt ein XPath Query auf XML-Daten aus
</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>
Die <literal>xpath</literal> Methode durchsucht den SimpleXML Knoten nach
Kind-Elementen, die der <acronym>XPath</acronym>
<parameter>path</parameter>-Anfrage entsprechen. Die Funktion gibt immer
ein <type>Array</type> von SimpleXMLElement-Objekten zurück.
</para>
<para>
<example>
<title>Xpath</title>
<programlisting role="php">
<![CDATA[
<?php
$string = <<<XML
<a>
<b>
<c>text</c>
<c>zeugs</c>
</b>
<d>
<c>code</c>
</d>
</a>
XML;
$xml = new SimpleXMLElement($string);
/* Suche nach <a><b><c> */
$result = $xml->xpath('/a/b/c');
while(list( , $node) = each($result)) {
echo '/a/b/c: ',$node,"\n";
}
/* Relative Pfade funktionieren ebenfalls ... */
$result = $xml->xpath('b/c');
while(list( , $node) = each($result)) {
echo 'b/c: ',$node,"\n";
}
?>
]]>
</programlisting>
<para>
Das Skript erzeugt die Ausgaben:
</para>
<screen>
<![CDATA[
/a/b/c: text
/a/b/c: zeugs
b/c: text
b/c: zeugs
]]>
</screen>
<simpara>
Beachten Sie, dass beide Ergebnisse gleich sind.
</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
-->