<?php
+// Some smart guy removed XMLReader's global constants from PHP 5.1
+// and replaced them with class constants. Breaking source compatibility
+// is SUPER awesome, and I love languages which do this constantly!
+$xmlReaderConstants = array(
+ "NONE",
+ "ELEMENT",
+ "ATTRIBUTE",
+ "TEXT",
+ "CDATA",
+ "ENTITY_REF",
+ "ENTITY",
+ "PI",
+ "COMMENT",
+ "DOC",
+ "DOC_TYPE",
+ "DOC_FRAGMENT",
+ "NOTATION",
+ "WHITESPACE",
+ "SIGNIFICANT_WHITESPACE",
+ "END_ELEMENT",
+ "END_ENTITY",
+ "XML_DECLARATION",
+ "LOADDTD",
+ "DEFAULTATTRS",
+ "VALIDATE",
+ "SUBST_ENTITIES" );
+foreach( $xmlReaderConstants as $name ) {
+ $fullName = "XMLREADER_$name";
+ $newName = "XMLReader::$name";
+ if( !defined( $fullName ) ) {
+ if( defined( $newName ) ) {
+ define( $fullName, constant( $newName ) );
+ } else {
+ // broken or missing the extension...
+ }
+ }
+}
+
/**
* Readahead helper for making large MediaWiki data dumps;
* reads in a previous XML dump to sequentially prefetch text
var $atPageEnd = false;
var $lastPage = 0;
var $lastRev = 0;
-
+
function BaseDump( $infile ) {
$this->reader = new XMLReader();
$this->reader->open( $infile );
}
-
+
/**
* Attempts to fetch the text of a particular page revision
* from the dump stream. May return null if the page is
return null;
}
}
-
+
function debug( $str ) {
wfDebug( $str . "\n" );
//global $dumper;
//$dumper->progress( $str );
}
-
+
/**
* @access private
*/
$this->atEnd = true;
}
}
-
+
/**
* @access private
*/
$this->atPageEnd = true;
}
}
-
+
/**
* @access private
*/
$this->skipTo( 'text' );
return strval( $this->nodeContents() );
}
-
+
/**
* @access private
*/
}
return $this->close();
}
-
+
/**
* Shouldn't something like this be built-in to XMLReader?
* Fetches text contents of the current element, assuming
}
return $this->close();
}
-
+
/**
* @access private
*/