SimpleXMLElement->registerXPathNamespace()(PHP 5 >= 5.2.0) SimpleXMLElement->registerXPathNamespace() — Creates a prefix/ns context for the next XPath query ОписаниеSimpleXMLElement
bool registerXPathNamespace
( string $prefix
, string $ns
)
Creates a prefix/ns context for the next XPath query. In particular, this is helpful if the provider of the given XML document alters the namespace prefixes. registerXPathNamespace will create a prefix for the associated namespace, allowing one to access nodes in that namespace without the need to change code to allow for the new prefixes dictated by the provider. Список параметров
Возвращаемые значенияВозвращает TRUE в случае успешного завершения или FALSE в случае возникновения ошибки. Примеры
Пример #1 Setting a namespace prefix to use in an XPath query
<?phpNotice how the XML document shown in the example sets a namespace with a prefix of chap. Imagine that this document (or another one like it) may have used a prefix of c in the past for the same namespace. Since it has changed, the XPath query will no longer return the proper results and the query will require modification. Using registerXPathNamespace avoids future modification of the query even if the provider changes the namespace prefix. |
|
|
| © 2009 Тест скорости интернета | Boont.Ru |