From 62b9d47db1a8166ff6791cdff880415345bcf5bb Mon Sep 17 00:00:00 2001 From: Joe Huss Date: Fri, 6 Dec 2019 18:34:03 -0500 Subject: [PATCH] incorporated https://github.com/philipashlock/mediawiki-to-markdown/pull/19 --- convert.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/convert.php b/convert.php index 2553048..5695876 100755 --- a/convert.php +++ b/convert.php @@ -44,10 +44,16 @@ // Load XML file $file = file_get_contents($arguments['filename']); +libxml_use_internal_errors(true); + $xml = str_replace('xmlns=', 'ns=', $file); //$string is a string that contains xml... -$xml = new SimpleXMLElement($xml); +//$xml = new SimpleXMLElement($xml); +try { $xml = new SimpleXMLElement($xml, LIBXML_COMPACT | LIBXML_PARSEHUGE); } catch (Exception $e) { echo $e; } +foreach(libxml_get_errors() as $error) { + echo "\t", $error->message; +} $result = $xml->xpath('page'); $count = 0;