Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401]

(no description)

File Size: 174 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: XMLReader  - X-Ref

Class XMLReader
Wrapper around the built-in XMLReader

openFileInZip($zipFilePath, $fileInsideZipPath)   X-Ref
Opens the XML Reader to read a file located inside a ZIP file.

return: bool TRUE on success or FALSE on failure
param: string $zipFilePath Path to the ZIP file
param: string $fileInsideZipPath Relative or absolute path of the file inside the zip

getRealPathURIForFileInZip($zipFilePath, $fileInsideZipPath)   X-Ref
Returns the real path for the given path components.
This is useful to avoid issues on some Windows setup.

return: string The real path URI
param: string $zipFilePath Path to the ZIP file
param: string $fileInsideZipPath Relative or absolute path of the file inside the zip

fileExistsWithinZip($zipStreamURI)   X-Ref
Returns whether the file at the given location exists

return: bool TRUE if the file exists, FALSE otherwise
param: string $zipStreamURI URI of a zip stream, e.g. "zip://file.zip#path/inside.xml"

read()   X-Ref
Move to next node in document

return: bool TRUE on success or FALSE on failure

readUntilNodeFound($nodeName)   X-Ref
Read until the element with the given name is found, or the end of the file.

return: bool TRUE on success or FALSE on failure
param: string $nodeName Name of the node to find

next($localName = null)   X-Ref
Move cursor to next node skipping all subtrees

return: bool TRUE on success or FALSE on failure
param: string|null $localName The name of the next node to move to

isPositionedOnStartingNode($nodeName)   X-Ref

return: bool Whether the XML Reader is currently positioned on the starting node with given name
param: string $nodeName

isPositionedOnEndingNode($nodeName)   X-Ref

return: bool Whether the XML Reader is currently positioned on the ending node with given name
param: string $nodeName

isPositionedOnNode($nodeName, $nodeType)   X-Ref

return: bool Whether the XML Reader is currently positioned on the node with given name and type
param: string $nodeName
param: int $nodeType

getCurrentNodeName()   X-Ref

return: string The name of the current node, un-prefixed