Error Loading Simple XML

Posted by Rooneyl on Stack Overflow See other posts from Stack Overflow or by Rooneyl
Published on 2012-04-13T11:25:21Z Indexed on 2012/04/13 11:28 UTC
Read the original article Hit count: 324

Filed under:
|
|
|

I have an xml document (generated from msword 2010), which I am trying to process using simple xml.

Sample of xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">
<w:body>
    <w:p w:rsidR="005B1098" w:rsidRDefault="005B1098"/>
    <w:p w:rsidR="00F254A4" w:rsidRDefault="00F254A4"/>
    <w:p w:rsidR="00F254A4" w:rsidRPr="008475A1" w:rsidRDefault="00C15492" w:rsidP="008475A1">
        <w:pPr>
            <w:jc w:val="center"/>
            <w:rPr>
                <w:b/>
                <w:sz w:val="44"/>
                <w:szCs w:val="44"/>
            </w:rPr>
        </w:pPr>
        <w:r w:rsidRPr="008475A1">
            <w:rPr>
                <w:b/>
                <w:sz w:val="44"/>
                <w:szCs w:val="44"/>
            </w:rPr>
            <w:t>Test file</w:t>
        </w:r>
    </w:p>
    <w:p w:rsidR="00C15492" w:rsidRPr="008475A1" w:rsidRDefault="00C15492" w:rsidP="008475A1">
        <w:pPr>
            <w:jc w:val="center"/>
            <w:rPr>
                <w:sz w:val="20"/>
                <w:szCs w:val="20"/>
            </w:rPr>
        </w:pPr>
        <w:r w:rsidRPr="008475A1">
            <w:rPr>
                <w:sz w:val="20"/>
                <w:szCs w:val="20"/>
            </w:rPr>
            <w:t>another paragraph</w:t>
        </w:r>
    </w:p>
</w:body>
</w:document>

I am trying to open it using:

if(!$simple_xml = simplexml_load_file($content)){
    trigger_error('Error reading XML file',E_USER_ERROR);
} else {
    echo 'loaded';
}

And get the error:

Message: simplexml_load_file(): I/O warning : failed to load external entity " Test file another paragraph "

Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml