Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974910
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:37:24+00:00 2026-05-20T04:37:24+00:00

Hi I’m trying to convert the XML file into associative array by using the

  • 0

Hi I’m trying to convert the XML file into associative array by using the following code

$xmlUrl = '../products.xml';
$xmlStr = file_get_contents($xmlUrl); 
$xmlObj = simplexml_load_string($xmlStr);  print_r ($xmlObj);exit;
$arrXml = objectsIntoArray($xmlObj);

and product.xml containing

<?xml version="1.0" encoding="utf-8"?>
<products>
  <product>
    <sku>p750h3</sku>
    <category>Plans: Vodafone Unlimited Cap</category>
    <price>$0</price>
    <totalmonthlycost>$129</totalmonthlycost>
    <totalmincost>$3096</totalmincost>
    <upfront>$0</upfront>
    <imageurl>http://store.vodafone.com.au/Images/Upload/nokia-6260-slide-front_118x307.png</imageurl>
    <threedurl>http://store.vodafone.com.au/handset-nokia-6260-slide.aspx#3d</threedurl>
    <smallimageurl>http://store.vodafone.com.au/Images/Upload/nokia-6260-slide-front_23x60.png</smallimageurl>
    <name>Nokia 6260 Slide $129 Unlimited Cap - 24 Months</name>
    <description></description>
    <ctppage>http://store.vodafone.com.au/handset-nokia-6260-slide.aspx</ctppage>
    <features>
      <![CDATA[
                Exclusive to Vodafone, this advanced all &ndash; in - one device has advanced web and navigation features plus a handy 360 degree Navi key to help you stay in control.<br/><ul>
        <li>5 MP camera with Carl Zeiss optics and Flash</li>
        <li>WiFi, HSDPA and HSUPA</li>
        <li>Integrated GPS Navigation</li>
        <li>3G (<a href="/whatis3g-popup.aspx" onclick="window.open(this.href,'','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=600,height=590,status'); return false"><u>What's this?</u></a>)</li>
        </ul>
            ]]>
    </features>
    <available>Yes</available>
    <shippingcost>$0.0</shippingcost>
    <dimensions></dimensions>
    <manufacturer>Nokia</manufacturer>
    <modelnumber>6260 Slide</modelnumber>
    <currency>AUD</currency>
    <devicekeypoints>&lt;ul&gt;

      &lt;li&gt;5 MP camera with Carl Zeiss optics and Flash&lt;/li&gt;
      &lt;li&gt;WiFi, HSDPA and HSUPA&lt;/li&gt;
      &lt;li&gt;Integrated GPS Navigation&lt;/li&gt;
      &lt;li&gt;3G (&lt;a href="/whatis3g-popup.aspx" onclick="window.open(this.href,'','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=600,height=590,status'); return false"&gt;&lt;u&gt;What's this?&lt;/u&gt;&lt;/a&gt;)&lt;/li&gt;

      &lt;/ul&gt;</devicekeypoints>
    <deviceTagline></deviceTagline>
    <deviceColor>Black</deviceColor>
    <deviceSpecialOffers></deviceSpecialOffers>
    <deviceMonthlyHandsetCost>0.0</deviceMonthlyHandsetCost>
    <deviceRecommendedPlan>$129 Unlimited Cap - 24 Months</deviceRecommendedPlan>
    <deviceOverallRating></deviceOverallRating>
    <plan>
      <term>24</term>
      <monthlyCapCost>$129</monthlyCapCost>
      <getMonthly>
        <![CDATA[Monthly credit amount - UNLIMITED<br/>Monthly data - 4GB<sup>3</sup><br/>Vodafone to Vodafone Calls - UNLIMITED<br/>Also includes - Voicemail retrieval <br/><br/>Flexi credit amount - NA<br/>Standard national voice calls - UNLIMITED<br/>Standard txt and pxt - UNLIMITED<br/>]]>
      </getMonthly>
    </plan>
  </product>...etc

but it returns a error message as follows

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : String not started expecting ' or " in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24

Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24

Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Malformed declaration expecting version in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24

Warning: simplexml_load_string() [function.simplexml-load-string]: <?xml version=\"1.0\" encoding=\"utf-8\"?> in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in D:\EBU\xampp\htdocs\biglinks\include\productUpdate.php on line 24......etc

I am trying to fix this issue whole day and searching solution over the net but i could not get . Please let me know the reason?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:37:25+00:00Added an answer on May 20, 2026 at 4:37 am

    This is probably caused by magic_quotes_runtime adding backslashes when you call file_get_contents. Try the following:

    $xmlUrl = '../products.xml';
    $xmlStr = file_get_contents($xmlUrl); 
    if (get_magic_quotes_runtime())
    {
        $xmlStr = stripslashes($xmlStr);
    }
    $xmlObj = simplexml_load_string($xmlStr);  print_r ($xmlObj);exit;
    $arrXml = objectsIntoArray($xmlObj);    $xmlStr = file_get_contents($xmlUrl);
    

    Alternatively you could disable magic_quotes_runtime (although this may have effects elsewhere in your script) in your PHP configuration, via .htaccess, or by adding the following near the top of your script:

    set_magic_quotes_runtime(false);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm making a simple page using Google Maps API 3. My first. One marker
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.