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.

XML format importer class

Copyright: 2008 Andrei Bautu
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 155 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

xml_database_importer:: (4 methods):
  get_parser()
  tag_open()
  tag_close()
  cdata()


Class: xml_database_importer  - X-Ref

XML format importer class (uses SAX for speed and low memory footprint).
Provides logic for parsing XML data and calling appropriate callbacks.
Subclasses should define XML data sources.

get_parser()   X-Ref
Creates and setups a SAX parser. Subclasses should use this method to
create the XML parser.

return: resource XML parser resource.

tag_open($parser, $tag, $attributes)   X-Ref
Callback function. Called by the XML parser for opening tags processing.

return: void
param: resource $parser XML parser resource.
param: string $tag name of opening tag
param: array $attributes set of opening tag XML attributes

tag_close($parser, $tag)   X-Ref
Callback function. Called by the XML parser for closing tags processing.

return: void
param: resource $parser XML parser resource.
param: string $tag name of opening tag

cdata($parser, $data)   X-Ref
Callback function. Called by the XML parser for character data processing.

return: void
param: resource $parser XML parser resource.
param: string $data character data to be processed