Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | List of all members
core_xml_parser Class Reference

Class for parsing xml files. More...

Public Member Functions

 parse ($data, $whitespace=1, $encoding='UTF-8', $reporterrors=false)
 Parses XML string. More...
 

Detailed Description

Class for parsing xml files.

Handles functionality for:

Import of xml files in questionbank and course import. Can handle xml files larger than 10MB through chunking the input file. Uses a similar interface to the original version xmlize() by Hans Anderson.

@subpackage lib

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ parse()

core_xml_parser::parse (   $data,
  $whitespace = 1,
  $encoding = 'UTF-8',
  $reporterrors = false 
)

Parses XML string.

Note: Interface is kept equal to previous version.

Author
Kilian Singer
Parameters
string$datathe XML source to parse.
int$whitespaceIf set to 1 allows the parser to skip "space" characters in xml document. Default is 1
string$encodingSpecify an OUTPUT encoding. If not specified, it defaults to UTF-8.
bool$reporterrorsif set to true, then a xml_format_exception exception will be thrown if the XML is not well-formed. Otherwise errors are ignored.
Return values
arrayrepresentation of the parsed XML.

The documentation for this class was generated from the following file: