Page 1 of 1

XML Parse problem

Posted: Thu Aug 27, 2009 12:05 pm
by ctrLogicDotNet
Hi,
I'm having troubles parsing an XML file...

Would have liked to use simpleXML as I'm used to, but it's not working cause I have attributes in a parent node...

Looked at XmlParser, not sure that the information I've read is enough to throw myself into it...

Here's my XML file:

Code: Select all

 
<?xml version="1.0" encoding="UTF-8"?>
<first_node>
    <child_lvl_one attr="">
        <child_lvl_two attrone="" attrtwo=""/>
    </child_lvl_one>
</first_node>
<second_node>
    <child_lvl_one>
        <child_lvl_two attrone="" attrtwo=""/>
    </child_lvl_one>
</second_node>
 

Re: XML Parse problem

Posted: Thu Aug 27, 2009 12:32 pm
by ctrLogicDotNet
Wow I've retried this with simpleXml and it seems to work...
Don't know what went wrong...
Sorry for those questioning themselves about this issue

Still Thank You for answers and post any comments about similar problems if they occur

Re: XML Parse problem

Posted: Thu Aug 27, 2009 12:42 pm
by ctrLogicDotNet
My problem was that one of my parents attribute had an & (ampersand) character...

Re: XML Parse problem

Posted: Thu Aug 27, 2009 1:09 pm
by requinix
ctrLogicDotNet wrote:My problem was that one of my parents attribute had an & (ampersand) character...
Then it should be escaped as & otherwise it's assumed to be the beginning of an entity (like &nbsp; or &#1234;).
If it's not escaped it could make the XML invalid.