I am trying to convert a Word-generated XML file to JSON through PHP.
I have looked around and found for all XML files the best case to be the following code (even on PHP documentation):
$xml = simplexml_load_string($xml_string);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
The problem is that after simplexml_load_string
I get an empty SimpleXMLElement
object and the rest of the steps cannot really go through.
The xml itself begins as :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:wordDocument
and the tags have a prefix of w:
.
I have tried removing the w:
s but again the function returns an empty object. Any idea what I might be missing? Is there anything special about this type of generated XML ?