Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

This class represent one XMLDB file

Copyright: 1999 onwards Martin Dougiamas http://dougiamas.com
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 204 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

xmldb_file:: (10 methods):
  __construct()
  fileExists()
  fileWriteable()
  getStructure()
  validateXMLStructure()
  loadXMLStructure()
  arr2xmldb_structure()
  setDTD()
  setSchema()
  saveXMLFile()


Class: xmldb_file  - X-Ref

__construct($path)   X-Ref
Constructor of the xmldb_file

param: string $path

fileExists()   X-Ref
Determine if the XML file exists

return: bool

fileWriteable()   X-Ref
Determine if the XML is writeable

return: bool

getStructure()   X-Ref
No description

validateXMLStructure()   X-Ref
This function will check/validate the XML file for correctness
Dynamically if will use the best available checker/validator
(expat syntax checker or DOM schema validator

return: true

loadXMLStructure()   X-Ref
Load and the XMLDB structure from file

return: true

arr2xmldb_structure($xmlarr)   X-Ref
This function takes an xmlized array and put it into one xmldb_structure

param: array $xmlarr
return: xmldb_structure

setDTD($path)   X-Ref
This function sets the DTD of the XML file

param: string

setSchema($path)   X-Ref
This function sets the schema of the XML file

param: string

saveXMLFile()   X-Ref
This function saves the whole xmldb_structure to its file

return: int|bool false on failure, number of written bytes on success