Replies: 5   Views: 1964
Handle other xml namespaces
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Aldryss  · 18-03-2020 - 09:22


Our company uses phpdocx and we encountered a problem while importing a docx file where the document.xml has the following document declaration :

<w:document xmlns:w="" xmlns:aink="" xmlns:am3d="" xmlns:cx="" xmlns:cx1="" xmlns:cx2="" xmlns:cx3="" xmlns:cx4="" xmlns:cx5="" xmlns:cx6="" xmlns:cx7="" xmlns:cx8="" xmlns:m="" xmlns:mc="" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w14="" xmlns:w15="" xmlns:w16cid="" xmlns:w16se="" xmlns:wne="" xmlns:wp="" xmlns:wp14="" xmlns:wpi="" mc:Ignorable="w14 w15 w16se w16cid wne wp14" w:conformance="strict">

the error occurs when extracting text from a docx document (using the Docx2Text class), on 

$bodyNode = $this->domDocument->getElementsByTagNameNS('', 'body');

Could you handle other valid xml namespaces, so these documents are also parsed by phpdox?

Thanks a lot

Posted by admin  · 18-03-2020 - 09:32


What license and version of phpdocx are using?


Posted by Aldryss  · 18-03-2020 - 15:26

Hi, thanks for the quick reply, it's premium 9.5

Posted by admin  · 18-03-2020 - 16:11


UPDATE: strict support was added in phpdocx 10 (Premium licenses).

The problem is that the DOCX uses the strict variant (w:conformance="strict"), that doesn't use the same XML namespaces than the transitional variant.

Strict variant support is a work in progress (its support is beta and it's being tested), and it will be included in the next release of phpdocx. You can use the transitional variant resaving the DOCX.


Posted by Aldryss  · 19-03-2020 - 17:23

Hi, do you have an ETA for this new release ?

Posted by admin  · 19-03-2020 - 17:28


This feature was added in phpdocx 10.