Convertig xml into array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys. I have the following XML file which I want to convert into a
multidimensional array. I am using PHP5 so don't want to use
SimpleXML as apparently there are issues with sessions and after
conversion I want to pass this array into the session. Any ideas on
the best and cleanest way to do this?

<?xml version="1.0" encoding="UTF-8"?>
<cpl_export>
 <setup>
    <version>0.1</version>
     <url>http://cpl.jellyfish.co.uk/service/</url>
 </setup>
 <id>userid</id>
 <items>

        <item id="1" selected="TRUE">
            <price>19.99</price>
            <renewal_price>25.99</renewal_price>
            <frequency>monthly</frequency>
            <description><![CDATA[Description of Item]]></description>
            <discount>20%</discount>
            <payment_types>

                <payment_type id="1">
                    Credit Card
                </payment_type>
                <payment_type id="2">
                    Direct Debit
                </payment_type>
            </payment_types>
            <media_code>12345</media_code>
            <item_type>gift</item_type>

            <zones>
                <zone>UK</zone>
                <zone>EIRE</zone>
                <zone>CHEESE</zone>
            </zones>
        </item>
        <item id="2" selected="FALSE">

            <price>8.99</price>
            <renewal_price>12.99</renewal_price>
            <frequency>annually</frequency>
            <description><![CDATA[Description of Item]]></description>
            <discount>25%</discount>
            <payment_types>
                <payment_type id="1">

                    Credit Card
                </payment_type>
                <payment_type id="2">
                    Direct Debit
                </payment_type>
            </payment_types>
            <media_code>12345</media_code>
            <item_type>standard subscription</item_type>
            <zones>

                <zone>UK</zone>
                <zone>EIRE</zone>
                <zone>CHEESE</zone>
            </zones>
        </item>
    </items>
 <form_elements>

    <page name="signup1">
            <content_header>
            <![CDATA[Some content for this pages header]]>
            </content_header>
            <content_footer>
            <![CDATA[Some content for this pages footer]]>
            </content_footer>
            <fieldset id="intro">
                <field id="firstname">

                    Enter your first name:
                </field>
                <field id="surname">
                    Enter your surnane:
                </field>
                <field id="email">
                    Enter your email address:
                </field>
            </fieldset>
        </page>

 </form_elements>
 <skinning>
        <skin id="header" alt="Sign up, you lovely
customer!">campaign_header.jpg</skin>
        <skin id="logo" alt="Some Magazine Logo">logo.jpg</skin>
        <skin id="submit_button">submit.jpg</skin>
 </skinning>
</cpl_export>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux