Results 1 to 6 of 6

Thread: SimpleXML

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Posts
    21

    Default SimpleXML

    I have a web page that uses SimpleXML but it does not appear to be supported on my WESTHOST account. My account is still 3.0 and is running PHP 5.2.6. It was my understanding that SimpleXML was in the base PHP as of 5.1.2. Do I need to upgrade PHP or is SimpleXML just not available. I will have to be careful with any PHP upgrades as I have a script that makes heavy use of the deprecated eregi function.
    Tony T

  2. #2
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,721

    Default

    No you should have SimpleXML installed on your php version in a Site Manager account. What may be happening though is if you try to access external URL's it would fail because by allow_url_fopen is turned off.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  3. #3
    Junior Member
    Join Date
    Jan 2005
    Posts
    21

    Default

    I must be doing something wrong then. Here is a snippit of my code:
    <body>

    <?php include("database/mealitems.xml"); ?>
    <?php
    echo "ENTER NEW PHP";
    echo $xmlstr;
    $dishes = new SimpleXMLElement($xmlstr);
    echo "EXIT NEW PHP";
    ?>

    If I take out the SimpleXMLElement line, then my web pages shows the "ENTER..", the table data, then the "EXIT..." then the rest of the page.
    When I include the SimpleXMLElement line, then my web pages shows the "ENTER" and the table data. Then it quits.
    The first version can be seen at http://www.dinomasters.com/final/price.php
    The bad version can be seen at http://www.dinomasters.com/final/pricebad.php
    Tony T

  4. #4
    Junior Member
    Join Date
    Jan 2005
    Posts
    21

    Default

    I think it's now a table error on my part. I was able to correctly use SimpleXML using a web sample. Thanks for the help
    Tony T

  5. #5
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,721

    Default

    Tony,

    Did you create the mealitems.xml file or some other program? The XML is not right. If I access it directly then I get the following error:
    XML Parsing Error: junk after document element
    Location: http://www.dinomasters.com/final/database/mealitems.xml
    Line Number 15, Column 1:
    I think you need to wrap the entire list of <row> elements in a root or master tag but not completely sure. This is not my expertise but googleing the error seems to suggest that.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  6. #6
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,721

    Default

    Ahh... I see you figured it out while I was typing.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •