Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct () | |
addError ($error) | |
createParser () | |
destroyParser ($parser) | |
getErrors () | |
getStatus () | |
parse ($file) | |
parseStruct ($file, $tagsToMatch=array()) | |
parseText ($text) | |
parseTextStruct ($text, $tagsToMatch=array()) | |
setHandler ($handler) | |
Data Fields | |
$errors | |
$handler | |
Protected Member Functions | |
_getStream ($filenameOrUrl) | |
Generic class for parsing an XML document into a data structure.
Definition at line 28 of file XMLParser.inc.php.
XMLParser::__construct | ( | ) |
Constructor. Initialize parser and set parser options.
Definition at line 45 of file XMLParser.inc.php.
|
protected |
Get a PSR7 stream given a filename or URL.
$filenameOrUrl |
Definition at line 115 of file XMLParser.inc.php.
References PKPApplication\get(), and GuzzleHttp\Psr7\stream_for().
Referenced by parse(), and parseStruct().
XMLParser::addError | ( | $error | ) |
Add an error to the current error list
$error | string |
Definition at line 133 of file XMLParser.inc.php.
Referenced by parse(), and parseText().
XMLParser::createParser | ( | ) |
Initialize a new XML parser.
Definition at line 218 of file XMLParser.inc.php.
Referenced by parse(), parseText(), and parseTextStruct().
XMLParser::destroyParser | ( | $parser | ) |
Destroy XML parser.
$parser | resource |
Definition at line 229 of file XMLParser.inc.php.
Referenced by parse(), parseText(), and parseTextStruct().
XMLParser::getErrors | ( | ) |
Get the current list of errors
Definition at line 140 of file XMLParser.inc.php.
References $errors.
XMLParser::getStatus | ( | ) |
Determine whether or not the parser encountered an error (false) or completed successfully (true)
Definition at line 149 of file XMLParser.inc.php.
XMLParser::parse | ( | $file | ) |
Parse an XML file using the specified handler. If no handler has been specified, XMLParserDOMHandler is used by default, returning a tree structure representing the document.
$file | string full path to the XML file |
Definition at line 80 of file XMLParser.inc.php.
References $handler, _getStream(), addError(), createParser(), destroyParser(), and setHandler().
XMLParser::parseStruct | ( | $file, | |
$tagsToMatch = array() |
|||
) |
Parse an XML file using xml_parse_into_struct and return data in an array. This is best suited for XML documents with fairly simple structure.
$file | string full path to the XML file |
$tagsToMatch | array optional, if set tags not in the array will be skipped |
Definition at line 205 of file XMLParser.inc.php.
References _getStream(), and parseTextStruct().
XMLParser::parseText | ( | $text | ) |
Definition at line 49 of file XMLParser.inc.php.
References $handler, addError(), createParser(), destroyParser(), and setHandler().
XMLParser::parseTextStruct | ( | $text, | |
$tagsToMatch = array() |
|||
) |
Parse XML data using xml_parse_into_struct and return data in an array. This is best suited for XML documents with fairly simple structure.
$text | string XML data |
$tagsToMatch | array optional, if set tags not in the array will be skipped |
Definition at line 168 of file XMLParser.inc.php.
References createParser(), and destroyParser().
Referenced by parseStruct().
XMLParser::setHandler | ( | $handler | ) |
Set the handler to use for parse(...).
$handler | XMLParserHandler |
Definition at line 157 of file XMLParser.inc.php.
References $handler.
Referenced by parse(), and parseText().
array XMLParser::$errors |
object XMLParser::$handler |
instance of XMLParserHandler
Definition at line 33 of file XMLParser.inc.php.
Referenced by parse(), parseText(), and setHandler().