Forum


Replies: 1   Views: 3594
Xmlapi render() displays nothing.
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 mlacommare  · 02-02-2016 - 21:11

I'm atempting to use the PHPDocx 5.5 xmlapi with the following code samples and the page is returning blank. PHP 7 on a windows machine.  Any help in getting this to output a document would be great.  This is my first attempt at using the XMLAPI.

using the sample content.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<pdx:document xmlns:pdx="http://www.phpdocx.com/main" >
    <pdx:content>
        <pdx:embedHTML>
            <pdx:data pdx:dataId="" pdx:type="HTML"><![CDATA[<style>ul {color: blue; font-size: 14pt; font-family: Cambria}td {font-family: Arial}#redBG {background-color: red; color: #f0f0f0}table {border-collapse: collapse}</style><h1>The title of the HTML page</h1><p>A normal paragraph.</p><p class="heading2">This is a simple paragraph with <strong>text in bold</strong>.</p><p>Now we include a list:</p><ul><li>First item.</li><li>Second item with subitems:<ul><li style="color: red">First subitem.</li><li>Second subitem.</li></ul></li><li id="redBG">Third subitem.</li></ul><p>And now a table:</p><table><tbody><tr><td>Cell 1 1</td><td>Cell 1 2</td><td>Cell 1 3</td></tr><tr><td>Cell 2 1</td><td>Cell 2 2</td><td>Cell 2 3</td></tr></tbody></table>]]></pdx:data>
            <pdx:wordStyles>
                <pdx:wordStyle pdx:styleType="tag" pdx:name="LightListAccent3PHPDOCX"><![CDATA[<table>]]></pdx:wordStyle>
                <pdx:wordStyle pdx:styleType="tag" pdx:name="Heading1PHPDOCX"><![CDATA[<h1>]]></pdx:wordStyle>
                <pdx:wordStyle pdx:styleType="class" pdx:name="Heading2PHPDOCX">heading2</pdx:wordStyle>
            </pdx:wordStyles>
        </pdx:embedHTML>
    </pdx:content>
</pdx:document>

 

Config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<pdx:document xmlns:pdx="http://www.phpdocx.com/main" >
    <pdx:config>
        <pdx:output pdx:name="output" pdx:type="docx" />
    </pdx:config>
</pdx:document>

 

and php file code:

require_once '../../classes/CreateDocx.inc';

$docx = new XMLAPI('./Core/embedHTML/sample_2/config.xml');
$docx->setDocumentProperties('./Core/embedHTML/sample_2/settings.xml');
$docx->addContent('./Core/embedHTML/sample_2/content.xml');

$docx->render();