The XMLReader class
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.
Intro
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.
Class synopsis
Properties
attributeCountThe number of attributes on the node
baseURIThe base URI of the node
depthDepth of the node in the tree, starting at 0
hasAttributesIndicates if node has attributes
hasValueIndicates if node has a text value
isDefaultIndicates if attribute is defaulted from DTD
isEmptyElementIndicates if node is an empty element tag
localNameThe local name of the node
nameThe qualified name of the node
namespaceURIThe URI of the namespace associated with the node
nodeTypeThe node type for the node
prefixThe prefix of the namespace associated with the node
valueThe text value of the node
xmlLangThe xml:lang scope which the node resides
Predefined Constants
XMLReader Node Types
XMLReader::NONENo node type
XMLReader::ELEMENTStart element
XMLReader::ATTRIBUTEAttribute node
XMLReader::TEXTText node
XMLReader::CDATACDATA node
XMLReader::ENTITY_REFEntity Reference node
XMLReader::ENTITYEntity Declaration node
XMLReader::PIProcessing Instruction node
XMLReader::COMMENTComment node
XMLReader::DOCDocument node
XMLReader::DOC_TYPEDocument Type node
XMLReader::DOC_FRAGMENTDocument Fragment node
XMLReader::NOTATIONNotation node
XMLReader::WHITESPACEWhitespace node
XMLReader::SIGNIFICANT_WHITESPACESignificant Whitespace node
XMLReader::END_ELEMENTEnd Element
XMLReader::END_ENTITYEnd Entity
XMLReader::XML_DECLARATIONXML Declaration node
XMLReader Parser Options
XMLReader::LOADDTDLoad DTD but do not validate
XMLReader::DEFAULTATTRSLoad DTD and default attributes but do not validate
XMLReader::VALIDATELoad DTD and validate while parsing
XMLReader::SUBST_ENTITIESSubstitute entities and expand references
Changelog
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |
Xmlreader