ttpparker Posted July 16, 2013 Share Posted July 16, 2013 I am trying to parse the following XML using simplexml_load_string. <?xml version="1.0" encoding="utf-16"?><rialtowebordersresponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ReturnStatus="1" xmlns="http://schemas.redarrow.co.uk/rialto"><orders /><errors><error OrderNo="BSTN4" ErrorCode="10010" ErrorMessage="Order already added" /></errors></rialtowebordersresponse> When I var_dump the variable I just get: bool(false). Anyone have any ideas why? Thanks Tony Link to comment https://forums.phpfreaks.com/topic/280203-xml-not-working-in-simplexml_load_string/ Share on other sites More sharing options...
mac_gyver Posted July 16, 2013 Share Posted July 16, 2013 do you have php's error_reporting/display_errors turned on? i get php warnings (whcih could be due to copy/pasting the text of your xml out of the forum) about - Document labelled UTF-16 but has UTF-8 content beyond that, you would probably need to post your code. Link to comment https://forums.phpfreaks.com/topic/280203-xml-not-working-in-simplexml_load_string/#findComment-1440935 Share on other sites More sharing options...
requinix Posted July 16, 2013 Share Posted July 16, 2013 That XML looks valid. We need to see some code. i get php warnings (whcih could be due to copy/pasting the text of your xml out of the forum) about - Document labelled UTF-16 but has UTF-8 contentIt's possible, even likely, that during the copy/paste into the post the text was automatically converted from UTF-16 to UTF-8. Link to comment https://forums.phpfreaks.com/topic/280203-xml-not-working-in-simplexml_load_string/#findComment-1440943 Share on other sites More sharing options...
ttpparker Posted July 17, 2013 Author Share Posted July 17, 2013 Never mind, I got it working. Thanks anyway. Link to comment https://forums.phpfreaks.com/topic/280203-xml-not-working-in-simplexml_load_string/#findComment-1441020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.