Forum


Replies: 10   Views: 11513
Warning: domdocument::loadxml(): empty string supplied as input
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 Sven May  · 19-02-2015 - 08:32

Hello! I've an HTML content with a number list:
  1. check enabled (warning appears if length < TORA)
  2. check disabled
I do not know how I can protect special HTML TAG chars here, sry...so the code above is an ol list with li subtags...and in below too... My code is: $docx = new \Phpdocx\Create\CreateDocx(); $wf = new Phpdocx\Elements\WordFragment(); $wf->embedHTML('
  1. check enabled (warning appears if length < TORA)
  2. check disabled
); $docx->createDocx('numbering_test'); ...and I got the following Warning: Warning: DOMDocument::loadXML(): Empty string supplied as input .... CreateDocx.inc line 4054 What is wrong? This is a part of my code. In real case I am using a template...so first I thought that is the problem but when I try to run it in a clean code like above I got the same error :(

Posted by admin  · 19-02-2015 - 09:34

Hello, You need to use this PHP function: http://php.net/htmlspecialchars And be sure Tidy is installed and enable. Regards.

Posted by Sven May  · 19-02-2015 - 09:45

Thanks! I did not think that could be the problem! Tidy is installed! I checked! But if I use htmlspecialchars...the suited content will be a text :( So this is not a good solution :( You meant that? My code is: $docx = new \Phpdocx\Create\CreateDocx(); $wf = new Phpdocx\Elements\WordFragment(); $wf->embedHTML(htmlspecialchars('
  1. check enabled (warning appears if length < TORA)
  2. check disabled
' ); $docx->createDocx('numbering_test');

Posted by admin  · 19-02-2015 - 11:41

Hello, Please send that script to contact@phpdocx.com Regards.

Posted by Sven May  · 19-02-2015 - 11:46

I checked that I installed successful Tidy. I use this page: http://polaps.politecnica.edu.gt/Quest/yen_PDF/phpdocx/check.php ...and give warning that I not installed Tidy yet however the pnpinfo say: I use and enabled Tidy...

Posted by Sven May  · 19-02-2015 - 11:51

I've sent! Thx (In another name: Attila Banhidy)

Posted by Sven May  · 19-02-2015 - 12:15

What I see in CreateDocx.php at importSingleNumbering() method that $numberingsXML is null if my HTML content include ol list TAGs. As you can see in my first post I insert HTML content into a table cell with WordFragment() class and I use CreateDocxFromTemplate() class to create my docx...

Posted by admin  · 19-02-2015 - 12:18

Hello, You don't have Tidy installed or enabled. Please enable it and try again. Regards.

Posted by Sven May  · 19-02-2015 - 12:49

I did...and tested...it is work! I sent my simple PHP code! I thonk the problem will be with WordFragment class embedHTML() method. If I use CreateDocx->embedHTML() method it works fine...but! I have to use WordFregment...if I change I got an XML content :( I am start to be a little bit confused....

Posted by admin  · 19-02-2015 - 13:37

Hello, Your code has a mistake. You can't use this line: $wf = new \Phpdocx\Elements\WordFragment(); You need to set the DOCX: $wf = new \Phpdocx\Elements\WordFragment($docx); With this minor change the script works perfectly. Regards.

Posted by Sven May  · 19-02-2015 - 14:17

Thanks your help!