Originariamente inviato da whisher
simpleXml for php4


Innanzitutto grazie per il suggerimento, ma avrei ancora bisogno di una mano...

Ho scaricato e provato la classe col mio XML e ne ricavo, se non interpreto male, una serie di ARRAY così configurati:

codice:
simplexmlobject Object
(
    [BODY] => simplexmlobject Object
        (
            [CLASSE] => Array
                (
                    [0] => simplexmlobject Object
                        (
                            [@attributes] => simplexmlobject Object
                                (
                                    [cod] => prima
                                )

                            [ALUNNO] => Array
                                (
                                    [0] => simplexmlobject Object
                                        (
                                            [@content] => Paolo
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 1
                                                )

                                        )

                                    [1] => simplexmlobject Object
                                        (
                                            [@content] => Gioia
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 2
                                                )

                                        )

                                )

                        )

                    [1] => simplexmlobject Object
                        (
                            [@attributes] => simplexmlobject Object
                                (
                                    [cod] => seconda
                                )

                            [ALUNNO] => Array
                                (
                                    [0] => simplexmlobject Object
                                        (
                                            [@content] => Gianni
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 3
                                                )

                                        )

                                    [1] => simplexmlobject Object
                                        (
                                            [@content] => Cristina
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 4
                                                )

                                        )

                                )

                        )

                    [2] => simplexmlobject Object
                        (
                            [@attributes] => simplexmlobject Object
                                (
                                    [cod] => terza
                                )

                            [ALUNNO] => Array
                                (
                                    [0] => simplexmlobject Object
                                        (
                                            [@content] => Ettore
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 5
                                                )

                                        )

                                    [1] => simplexmlobject Object
                                        (
                                            [@content] => Antonia
                                            [@attributes] => simplexmlobject Object
                                                (
                                                    [num] => 6
                                                )

                                        )

                                )

                        )

                )

        )

)
Non nascondo che ho grosse difficoltà a estrarre da questi ARRAY i miei record da inserire nel DB. (intendo: classe alunno, nome alunno e numero alunno)

Potete darmi una mano?
Grazie.