Jump to content

XML not working in simplexml_load_string


Recommended Posts

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 />
<error OrderNo="BSTN4" ErrorCode="10010" ErrorMessage="Order already added" />


When I var_dump the variable I just get:




Anyone have any ideas why?






Link to comment
Share on other sites

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 content

It'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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.