El XML ya lo estoy recorriendo en su totalidad y estoy mostrando sus valores
trozo del XMl (Es mucho mas extenso)
Código XML:
Ver original
<CuentaAhorro fechaApertura="2012-12-13" calificacion="123" situacionTitular="123" oficina="123" ciudad="123" codigoDaneCiudad="123" codSuscriptor="123" tipoIdentificacion="123" identificacion="123" sector="123"> <Caracteristicas clase="123" /> <Estado codigo="123" fecha="2012-12-13" /> <Reclamo numero="123" tipoLeyenda="123" tipo="123" fecha="2012-12-13" estado="123" ratificado="true" numeroCuenta="123" texto="123" entidad="123" fechaCierre="2012-12-13"> <Subtipo codigo="123" nombre="123" /> <Llave>123</Llave> </Reclamo> <Adjetivo codigo="123" fecha="2012-12-13" /> <Llave>123</Llave> </CuentaAhorro>
Código PHP:
Ver original
function fnRecorreXmlRecursivo($xmlObj, $depth = 0) { if ($depth == 0) { $this->padre = $xmlObj->children()->getName(); } $anterior = $xmlObj; foreach ($xmlObj->children() as $hijo) {//caracteristica echo "<br>"; echo str_repeat('-', $depth) . "<strong>" . $this->padre . $anterior->getName() . $hijo->getName() . "</strong>_<strong></strong>";// . $hijo->getName(); } else { } foreach ($hijo->attributes() as $attr) { echo $attr->getName() . "|" . $attr . ";"; } $this->fnRecorreXmlRecursivo($hijo, $depth + 1); } }
el resultado que obtengo es este:
-InformeCuentaAhorro_bloqueada|true;entidad|123;numero|123;fechaApertu ra|2012-12-13;calificacion|123;situacionTitular|123;oficina|1 23;ciudad|123;codigoDaneCiudad|123;codSuscriptor|1 23;tipoIdentificacion|123;identificacion|123;secto r|123;
--InformeCuentaAhorroCaracteristicas_clase|123;
--CuentaAhorroValores_
---InformeValoresValor_moneda|123;creditosEfectivo|3.1415926535;debitosE fectivo|3.1415926535;creditosTransferencia|3.14159 26535;debitosTransferencia|3.1415926535;fecha|2012-12-13;calificacion|123;
--InformeCuentaAhorroEstado_codigo|123;fecha|2012-12-13;
--CuentaAhorroReclamo_numero|123;tipoLeyenda|123;tipo|123;fecha|2012-12-13;estado|123;ratificado|true;numeroCuenta|123;tex to|123;entidad|123;fechaCierre|2012-12-13;
---InformeReclamoSubtipo_codigo|123;nombre|123;
---InformeReclamoLlave_
--InformeCuentaAhorroAdjetivo_codigo|123;fecha|2012-12-13;
--InformeCuentaAhorroLlave_
Las llaves deberia ser asi:
-InformeCuentaAhorro
--InformeCuentaAhorroCaracteristicas
--InformeCuentaAhorroValores
---InformeCuentaAhorroValoresValor
--InformeCuentaAhorroEstado
--InformeCuentaAhorroReclamo
---InformeCuentaAhorroReclamoSubtipo
---InformeCuentaAhorroReclamoLlave
--InformeCuentaAhorroAdjetivo
--InformeCuentaAhorroLlave
Agradezco la ayuda que me puedan dar