How to convert word to xml format using php?

should the contents of the word document that contains text, figures, recorded in a mysql table. Estimated strucrure file

question text picture text
response A)the text
B) text
C) the text
D) the text
E) lyrics
the correct answer is B
For this I want to convert to xml and manually import it into MySQL
<database name="DB_NAME">
<!-- Questions table -->
<column name="question_id">1</column><column name="question">question 1</column><column name="answer_a">answer_a 1</column><column name="answer_b">answer_b 2</column><column name="answer_c">answer_c 3</column><column name="answer_d">answer_d 4</column><column name="answer_e">answer_e 5</column><column name="right_answer">right_answer 1</column><table name="questions">








</table></database>

or if you can automate, then immediately worda in mysql
July 9th 19 at 10:37
1 answer
July 9th 19 at 10:39
The idea is to document the docx format is already an xml document compressed by the zip algorithm. All you will need is:

$zip = new ZipArchive;
$doc_file = './publisher.docx';
$zip->open($doc_file);
$zip->extractTo('./tmp');


Then look at the content and use the function simplexml_load_file:

$xml = simplexml_load_file("./tmp/path_to.xml");
$xml->registerXPathNamespace('w',"http://schemas.openxmlformats.org/wordprocessingml/2006/main");
$text = $xml->xpath('//w:t');
echo '<pre>'; print_r($text); echo '</pre>';


Stackoverflow

Find more questions by tags PHPXML