搜索
首页后端开发XML/RSS教程PHP扩展之XML操作(四)——XMLReader

PHP扩展之XML操作(四)——XMLReader

Feb 13, 2017 pm 03:03 PM
php扩展xml操作



一、概述及安装

The XMLReader extension is an XML Pull parser. The reader acts as a cursor going forward on the document stream and stopping at each node on the way.

It is important to note that internally, libxml uses the UTF-8 encoding and as such, the encoding of the retrieved contents will always be in UTF-8 encoding.

此扩展需要 libxml PHP 扩展。这表示需要使用 --enable-libxml ,尽管这将隐式完成因为 libxml 是缺省开启的。

The XMLReader extension was initially a PECL extension for PHP 5. It was later moved to the PHP source (bundled) as of PHP 5.1.0, and later enabled by default as of PHP 5.1.2.

此扩展默认为启用,编译时可通过下列选项禁用: --disable-xmlreader

二、XMLReader类及其成员函数

  • XMLReader::close — Close the XMLReader input

  • XMLReader::expand — Returns a copy of the current node as a DOM object

  • XMLReader::getAttribute — Get the value of a named attribute

  • XMLReader::getAttributeNo — Get the value of an attribute by index

  • XMLReader::getAttributeNs — Get the value of an attribute by localname and URI

  • XMLReader::getParserProperty — Indicates if specified property has been set

  • XMLReader::isValid — Indicates if the parsed document is valid

  • XMLReader::lookupNamespace — Lookup namespace for a prefix

  • XMLReader::moveToAttribute — Move cursor to a named attribute

  • XMLReader::moveToAttributeNo — Move cursor to an attribute by index

  • XMLReader::moveToAttributeNs — Move cursor to a named attribute

  • XMLReader::moveToElement — Position cursor on the parent Element of current Attribute

  • XMLReader::moveToFirstAttribute — Position cursor on the first Attribute

  • XMLReader::moveToNextAttribute — Position cursor on the next Attribute

  • XMLReader::next — Move cursor to next node skipping all subtrees

  • XMLReader::open — Set the URI containing the XML to parse

  • XMLReader::read — Move to next node in document

  • XMLReader::readInnerXML — Retrieve XML from current node

  • XMLReader::readOuterXML — Retrieve XML from current node, including it self

  • XMLReader::readString — Reads the contents of the current node as a string

  • XMLReader::setParserProperty — Set parser options

  • XMLReader::setRelaxNGSchema — Set the filename or URI for a RelaxNG Schema

  • XMLReader::setRelaxNGSchemaSource — Set the data containing a RelaxNG Schema

  • XMLReader::setSchema — Validate document against XSD

  • XMLReader::XML — Set the data containing the XML to parse

以上就是PHP扩展之XML操作(四)——XMLReader的内容,更多相关内容请关注PHP中文网(www.php.cn)!


声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
XML中的RSS:解码标签,属性和结构XML中的RSS:解码标签,属性和结构Apr 24, 2025 am 12:09 AM

RSS是一种基于XML的格式,用于发布和订阅内容。RSS文件的XML结构包括根元素、元素和多个元素,每个代表一个内容条目。通过XML解析器读取和解析RSS文件,用户可以订阅并获取最新内容。

XML在RSS中的优势:技术深度潜水XML在RSS中的优势:技术深度潜水Apr 23, 2025 am 12:02 AM

XML在RSS中具有结构化数据、可扩展性、跨平台兼容性和解析验证的优势。1)结构化数据确保内容的一致性和可靠性;2)可扩展性允许添加自定义标签以适应内容需求;3)跨平台兼容性使其在不同设备上无缝工作;4)解析和验证工具确保Feed的质量和完整性。

XML中的RSS:揭示内容联合的核心XML中的RSS:揭示内容联合的核心Apr 22, 2025 am 12:08 AM

RSS在XML中的实现方式是通过结构化的XML格式来组织内容。1)RSS使用XML作为数据交换格式,包含频道信息和项目列表等元素。2)生成RSS文件需按规范组织内容,发布到服务器供订阅。3)RSS文件可通过阅读器或插件订阅,实现内容自动更新。

超越基础:高级RSS文档功能超越基础:高级RSS文档功能Apr 21, 2025 am 12:03 AM

RSS的高级功能包括内容命名空间、扩展模块和条件订阅。1)内容命名空间扩展RSS功能,2)扩展模块如DublinCore或iTunes添加元数据,3)条件订阅根据特定条件筛选条目。这些功能通过添加XML元素和属性实现,提升信息获取效率。

XML主链:RSS提要如何结构XML主链:RSS提要如何结构Apr 20, 2025 am 12:02 AM

rssfeedsusexmltoStructureContentUpdates.1)xmlProvidesHierarchicalStructurefordata.2)theelementDefinestHefEed'sIdentityAndContainsElements.3)ElementsRementsRementsRepresSentividividividualContentpieces.4)rsssissisexisextensible,允许custemements.5)5)

RSS和XML:了解Web内容的动态二重奏RSS和XML:了解Web内容的动态二重奏Apr 19, 2025 am 12:03 AM

RSS和XML是用于网络内容管理的工具。RSS用于发布和订阅内容,XML用于存储和传输数据。它们的工作原理包括内容发布、订阅和更新推送。使用示例包括RSS发布博客文章和XML存储书籍信息。

RSS文档:Web联合组织的基础RSS文档:Web联合组织的基础Apr 18, 2025 am 12:04 AM

RSS文档是基于XML的结构化文件,用于发布和订阅频繁更新的内容。它的主要作用包括:1)自动化内容更新,2)内容聚合,3)提高浏览效率。通过RSSfeed,用户可以订阅并及时获取来自不同来源的最新信息。

解码RSS:内容提要的XML结构解码RSS:内容提要的XML结构Apr 17, 2025 am 12:09 AM

RSS的XML结构包括:1.XML声明和RSS版本,2.频道(Channel),3.条目(Item)。这些部分构成了RSS文件的基础,允许用户通过解析XML数据来获取和处理内容信息。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

螳螂BT

螳螂BT

Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

Atom编辑器mac版下载

Atom编辑器mac版下载

最流行的的开源编辑器