PHP: DOMXPath->registerNamespace() - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

dom_import_simplexml DOMXPath->query()

Last updated: Fri, 26 Jan 2007

view this page in

# DOMXPath->registerNamespace()

(no version information, might be only in CVS)

DOMXPath->registerNamespace() -- Registers the namespace with the DOMXPath object

## Описание

class DOMXPath {
bool registerNamespace ( string prefix, string namespaceURI )
}

Registers the `namespaceURI` and `prefix` with the DOMXPath object.

## Список параметров

`prefix`

  The prefix.

`namespaceURI`

  The URI of the namespace.

## Возвращаемые значения

Возвращает `TRUE` в случае успешного завершения или `FALSE` в случае возникновения ошибки.

add a note User Contributed Notes
DOMXPath->registerNamespace()
spam at spam dot spam
31-Mar-2005 12:46
`It is mentioned in a few places on the web, but it wasn't mentioned here. You need to use this function to set up a prefix for the default namespace of a document.
For instance, if you are trying to parse a Microsoft Spreadsheet XML file, which has the default namespace of "urn:schemas-microsoft-com:office:spreadsheet":
$doc = DOMDocument::load("my_spreadsheet.xml);
$xpath = new DOMXPath($doc);
$xpath->registerNamespace("m",
"urn:schemas-microsoft-com:office:spreadsheet");
$query = '/m:Workbook/m:Worksheet[1]/m:Table';
$result = $xpath->query($query, $doc);
You can use anything in place of the 'm', but you have to specify something! Just asking for "/Workbook/Worksheet/Table" doesn't work.`
add a note
dom_import_simplexml DOMXPath->query()

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST