Latest web development tutorials
×

PHP Kurs

PHP Kurs PHP Kurze Einführung PHP installieren PHP Grammatik PHP Variable PHP echo/print PHP Datentypen PHP Konstante PHP Schnur PHP Die Betreiber PHP If...Else PHP Switch PHP Feld PHP Sortieren eines Array PHP Superglobals PHP While Verkehr PHP For Verkehr PHP Funktion PHP Magische Variablen PHP Namespaces PHP Objektorientiert

PHP Form

PHP Form PHP Formularauthentifizierung PHP Form - Erforderliche Felder PHP Form - Überprüfung E-Mail und URL PHP Komplette Formularinstanz PHP $_GET Variable PHP $_POST Variable

PHP Erweiterte Tutorial

PHP Mehrdimensionale Arrays PHP Datum PHP enthalten PHP Datei PHP Datei-Upload PHP Cookie PHP Session PHP E-mail PHP Sicherheit E-mail PHP Error PHP Exception PHP Filter PHP Erweiterte Filter PHP JSON

PHP 7 Neue Funktionen

PHP 7 Neue Funktionen

PHP Datenbank

PHP MySQL Kurze Einführung PHP MySQL Verbindung PHP MySQL Erstellen einer Datenbank PHP MySQL Erstellen Sie eine Datentabelle PHP MySQL einfügen von Daten PHP MySQL Legen Sie mehrere Daten PHP MySQL Prepared Statements PHP MySQL Lesen Sie Daten PHP MySQL WHERE PHP MySQL ORDER BY PHP MySQL UPDATE PHP MySQL DELETE PHP ODBC

PHP XML

XML Expat Parser XML DOM XML SimpleXML

PHP & AJAX

AJAX Kurze Einführung AJAX PHP AJAX Datenbank AJAX XML AJAX Echtzeitsuche AJAX RSS Reader AJAX Abstimmung

PHP Referenzhandbuch

PHP Array PHP Calendar PHP cURL PHP Date PHP Directory PHP Error PHP Filesystem PHP Filter PHP FTP PHP HTTP PHP Libxml PHP Mail PHP Math PHP Misc PHP MySQLi PHP PDO PHP SimpleXML PHP String PHP XML PHP Zip PHP Timezones PHP Bildverarbeitung PHP RESTful

PHP registerXPathNamespace () Funktion

PHP SimpleXML Reference Manual PHP SimpleXML Reference Manual

Beispiele

Für die nächste XPath-Abfrage, um einen Namespace Kontext zu erstellen:

<?php
$xml=<<<XML
<book xmlns:chap="http://example.org/chapter-title">
<title>My Book</title>
<chapter id="1">
<chap:title>Chapter 1</chap:title>
<para>Donec velit. Nullam eget tellus...</para>
</chapter>
<chapter id="2">
<chap:title>Chapter 2</chap:title>
<para>Lorem ipsum dolor sit amet....</para>
</chapter>
</book>
XML;

$sxe=new SimpleXMLElement($xml);
$sxe->registerXPathNamespace('c','http://example.org/chapter-title');
$result=$sxe->xpath('//c:title');
foreach ($result as $title)
{
echo $title . "<br>";
}
?>

Ausführung einer Instanz »

Definition und Verwendung

registerXPathNamespace () Funktion für den nächsten XPath-Abfrage einen Namespace-Kontext zu erstellen.

Wenn Sie das Namespacepräfix im XML-Dokument ändern, ist diese Funktion nützlich. registerXPathNamespace () Funktion wird ein Namespacepräfix angegeben, werden die betroffenen XML-Knoten erstellen kann ohne Änderung der Anwendungscode unter vielen Umständen zugegriffen werden.


Grammatik

registerXPathNamespace( prefix , ns );

参数 描述
prefix 必需。规定在 ns 指定的命名空间的 XPath 查询中使用的的命名空间前缀。
ns 必需。规定用于 XPath 查询的命名空间。

Technische Details

Rückkehr: Wenn dies gelingt es TRUE zurück, bei einem Fehler FALSCH.
PHP-Version: 5.2+


PHP SimpleXML Reference Manual PHP SimpleXML Reference Manual