I have a final kink to work out of an array to XML parser I've been writing.
The array structure is below, along with the example XML it came from.  A
link to the source I'm working on is at bottom.  The only problem this
script runs into is when there are multiple elements with the same name on
the same node level.  It crams all the values into a single element with
that name, and uses only the final element's attributes.  It seemed like
clone_node() was the answer, but it isn't working correctly in this
context -- anyone see why?  I sure don't.

[xml]
<?xml version="1.0"?>
<rootElement>
  <record id="1">Value 1</record>
  <record id="2">Value 2</record>
</rootElement>
[/xml]

[array]
Array
(
    [rootElement] => Array
        (
            [0] => Array
                (
                    [record] => Array
                        (
                            [0] => Array
                                (
                                    [ATTRIBUTES] => Array
                                        (
                                            [id] => 1
                                        )

                                    [VALUE] => Value 1
                                )

                            [1] => Array
                                (
                                    [ATTRIBUTES] => Array
                                        (
                                            [id] => 2
                                        )

                                    [VALUE] => Value 2
                                )

                        )

                )

        )

)
[/array]

Source:
http://www.healthtvchannel.org/test/php2xml.phps

Thanks,
--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org



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

Reply via email to