Can someone please help me with this issue. I am using a soap function(not developed by me) and it returns an XML string but for some reason PHP does not like it as an XML string.

<?xml version="1.0" ?><LossPayees>
<LP><N>1200 Auto Plex</N><I>1040</I></LP>
<LP><N>A P G Fed Credit Union</N><I>319</I></LP>
<LP><N>A S I Federal Credit Unit</N><I>230</I></LP>
<LP><N>Abco Federal Credit Union</N><I>765</I></LP>
<LP><N>Aberdeen Proving Ground FCU</N><I>607</I></LP>
<LP><N>Ac Services</N><I>684</I></LP>
<LP><N>Ace Motor Acceptance Corp.</N><I>787</I></LP>
.....some more values here
<LP><N>Wyandette FCU</N><I>949</I></LP>
<LP><N>Yardville Natl Bank</N><I>96</I></LP>
<LP><N>YNB</N><I>455</I></LP>
<LP><N>Zions</N><I>790</I></LP>
</LossPayees>

but I get the following when I try and load it:
Message = exception 'Exception' with message 'String could not be parsed as XML'

This error message is using new SimpleXMLElement(string)
If I use simplexml_load_string(string) it does nothing at all the strange thing is I have another string like so:

<?xml version='1.0' ?><DealerPolicies>
<Policy>
<PolicyTitle>14 days 25/50</PolicyTitle><DealerPolicyID>5723</DealerPolicyID><Premium>1</Premium>
</Policy>
<Policy>
<PolicyTitle>30 days 25/50</PolicyTitle><DealerPolicyID>5724</DealerPolicyID><Premium>1</Premium>
</Policy>
<Policy>
<PolicyTitle>7 days 25/50</PolicyTitle><DealerPolicyID>5722</DealerPolicyID><Premium>1</Premium>
</Policy>
</DealerPolicies>

that processes out just fine into an array and I can parse it without any issues is there a maximum number of objects php can handle? because the list is approximately 1000 entries long and I think that might be the issue.

Thanks

    Perhaps there is malformed XML in the portion of the string that you left out?

      I will post the whole xml on Monday when I get back in. Hopefully I am overlooking something and someone else can point it out because I cannot fin any issues with the XML.

      Thanks,

        Issue Solved. Some of the Items contained the ampersand (&) and apparently this is confusing in XML so I used str_replace and replaced & with &amp; and everything works perfectly now.

          Write a Reply...