Go to the documentation of this file.
68 'processing_instruction_handler' =>
'',
84 $this->filterCallback = $filterCallback;
85 $this->parserOptions = array_merge( $this->parserOptions,
$options );
101 return new self(
$fname, $filterCallback,
true );
116 return new self( $string, $filterCallback,
false );
133 $reader =
new XMLReader();
135 $s = $reader->open( $xml,
null, LIBXML_NOERROR | LIBXML_NOWARNING );
137 $s = $reader->XML( $xml,
null, LIBXML_NOERROR | LIBXML_NOWARNING );
141 $this->wellFormed =
false;
143 $oldDisable = libxml_disable_entity_loader(
true );
144 $reader->setParserProperty( XMLReader::SUBST_ENTITIES,
true );
147 }
catch ( Exception
$e ) {
150 $this->wellFormed =
false;
152 libxml_disable_entity_loader( $oldDisable );
156 libxml_disable_entity_loader( $oldDisable );
161 set_error_handler(
array( $this,
'XmlErrorHandler' ) );
162 $ret = $reader->read();
163 restore_error_handler();
168 $this->wellFormed =
false;
178 $this->wellFormed =
false;
181 if ( $reader->nodeType === XMLReader::PI ) {
184 }
while ( $reader->nodeType != XMLReader::ELEMENT );
188 switch ( $reader->nodeType ) {
189 case XMLReader::ELEMENT:
192 $reader->namespaceURI
194 if ( $this->rootElement ===
'' ) {
195 $this->rootElement =
$name;
197 $empty = $reader->isEmptyElement;
205 case XMLReader::END_ELEMENT:
210 case XMLReader::SIGNIFICANT_WHITESPACE:
211 case XMLReader::CDATA:
212 case XMLReader::TEXT:
216 case XMLReader::ENTITY_REF:
238 }
while ( $this->
readNext( $reader ) );
240 if ( $this->stackDepth !== 0 ) {
241 $this->wellFormed =
false;
242 } elseif ( $this->wellFormed ===
null ) {
243 $this->wellFormed =
true;
255 while ( $r->moveToNextAttribute() ) {
256 if ( $r->namespaceURI ===
'http://www.w3.org/2000/xmlns/' ) {
262 $attrs[
$name] = $r->value;
273 if ( $namespaceURI ) {
274 $parts = explode(
':',
$name );
275 $localname = array_pop( $parts );
276 return "$namespaceURI:$localname";
298 if ( is_callable( $this->filterCallback )
300 $this->filterCallback,
307 $this->filterMatch =
true;
316 $this->
elementData[ $this->stackDepth - 1 ] .= trim( $data );
324 if ( $this->parserOptions[
'processing_instruction_handler'] ) {
326 $this->parserOptions[
'processing_instruction_handler'],
331 $this->filterMatch =
true;
$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.
expandNS( $name, $namespaceURI)
getAttributesArray(XMLReader $r)
Get all of the attributes for an XMLReader's current node.
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
$elementData
A stack of strings containing the data of each xml element as it's processed.
$elementDataContext
A stack of element names and attributes, as we process them.
XmlErrorHandler( $errno, $errstr)
$wellFormed
Will be set to true or false to indicate whether the file is well-formed XML.
readNext(XMLReader $reader)
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
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
$stackDepth
Current depth of the data stack.
Allows to change the fields on the form that will be generated $name
getRootElement()
Get the root element.
elementOpen( $name, $attribs)
processingInstructionHandler( $target, $data)
validateFromInput( $xml, $isFile)
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
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e