Go to the documentation of this file.
46 'processing_instruction_handler' =>
'',
62 $this->filterCallback = $filterCallback;
63 $this->parserOptions = array_merge( $this->parserOptions,
$options );
84 return new self(
$fname, $filterCallback,
true );
98 public static function newFromString( $string, $filterCallback =
null ) {
99 return new self( $string, $filterCallback,
false );
117 $parser = xml_parser_create_ns(
'UTF-8' );
119 xml_parser_set_option(
$parser, XML_OPTION_CASE_FOLDING,
false );
120 xml_set_element_handler(
$parser,
array( $this,
'rootElementOpen' ),
false );
121 if ( $this->parserOptions[
'processing_instruction_handler'] ) {
122 xml_set_processing_instruction_handler(
124 array( $this,
'processingInstructionHandler' )
136 if ( file_exists(
$fname ) ) {
140 $chunk = fread(
$file, 32768 );
143 $this->wellFormed =
false;
148 }
while ( !feof(
$file ) );
153 $this->wellFormed =
true;
167 $this->wellFormed =
false;
170 $this->wellFormed =
true;
179 $this->rootElement =
$name;
181 if ( is_callable( $this->filterCallback ) ) {
182 xml_set_element_handler(
$parser,
array( $this,
'elementOpen' ),
false );
186 xml_set_element_handler(
$parser,
false,
false );
196 if ( call_user_func( $this->filterCallback,
$name,
$attribs ) ) {
198 $this->filterMatch =
true;
208 if ( call_user_func( $this->parserOptions[
'processing_instruction_handler'], $target, $data ) ) {
210 $this->filterMatch =
true;
getParser()
Get an XML parser with the root element handler.
$filterMatch
Will be set to true if the optional element filter returned a match at some point.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
static newFromString( $string, $filterCallback=null)
Alternative constructor: from string.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
__construct( $input, $filterCallback=null, $isFile=true, $options=array())
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
static newFromFilename( $fname, $filterCallback=null)
Alternative constructor: from filename.
$rootElement
Name of the document's root element, including any namespace as an expanded URL.
elementOpen( $parser, $name, $attribs)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
$wellFormed
Will be set to true or false to indicate whether the file is well-formed XML.
do that in ParserLimitReportFormat instead $parser
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
processing should stop and the error should be shown to the user * false
$parserOptions
Additional parsing options.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
processingInstructionHandler( $parser, $target, $data)
Allows to change the fields on the form that will be generated $name
validateFromString( $string)
getRootElement()
Get the root element.
validateFromFile( $fname)
if(PHP_SAPI !='cli') $file
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
rootElementOpen( $parser, $name, $attribs)