无为清净楼资源网 Design By www.qnjia.com

PHP registerXPathNamespace() 函数

实例

为下一个 XPath 查询创建命名空间上下文:

<"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>"; 
} 
"htmlcode">
registerXPathNamespace( _prefix_ , _ns_ );

PHP registerXPathNamespace()函数讲解

PHP registerXPathNamespace()函数讲解

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对的支持。如果你想了解更多相关内容请查看下面相关链接

标签:
registerxpathnamespace()函数,php,registerxpathnamespace()函数,registerxpathnamespace()函数讲解

无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com