I want to know how to read a domDocument with an xml inside

Asked

Viewed 19 times

0

Currently the project using a print_r in the variable xml and it returns that:

SimpleXMLElement Object ( [cidade] => SimpleXMLElement Object ( [@attributes] => Array ( [nome] => ARACAJU [estado] => SE ) [bairros] => SimpleXMLElement Object ( [bairro] => Array ( [0] => 18 DO FORTE [1] => AEROPORTO [2] => ARUANA [3] => ATALAIA [4] => CASTELO BRANCO [5] => CENTRO [6] => CIRURGIA [7] => CORO DO MEIO [8] => COROA DO MEIO [9] => FAROLâNDIA [10] => GETúLIO VARGAS [11] => GRAGERU [12] => INáCIO BARBOSA [13] => JABOTIANA [14] => JARDINS [15] => LUZIA [16] => PONTO NOVO [17] => SALGADO FILHO [18] => SANTA MARIA [19] => SANTO ANTôNIO [20] => SUíSSA [21] => SãO CONRADO [22] => TREZE DE JULHO ) ) ) )

I would like to know how to display only the neighborhoods or just the cities

  • 1

    post xml as well!

  • At a glance here, to convert Simplexmlelement to an array, then just access via Dice cidade or bairros.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.