Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of XMLReader extended by PHP

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is to share with you the content of a sample analysis of XMLReader for PHP extensions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

I. Overview and installation

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.

This extension requires a libxml PHP extension. This means that you need to use-- enable-libxml, although this will be done implicitly because libxml is enabled by default.

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.

This extension is enabled by default and can be disabled at compile time with the following options:-- disable-xmlreader

XMLReader class and its member functions

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 RelaxNGSchema

XMLReader::setRelaxNGSchemaSource-Set the data containing a RelaxNGSchema

XMLReader::setSchema-Validate document against XSD

XMLReader::XML-Set the data containing the XML to parse

Thank you for reading! This is the end of this article on "sample Analysis of XMLReader extended by PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report