Good day, I have an XML file which I have difficulty reading, my problem is in the labels, since they are not simple labels, the Teachers start with cfdi and the ones that have internally you start with ecb, which are what I I'm interested in getting its content, I've tried several methods, but I'm not successful, I hope you can help me, I'm new to XML, greetings XML:
<?xml version="1.0" encoding="utf-8"?>
<cfdi:Comprobante Version="3.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cfdi="http://www.sat.gob.mx/cfd/3">
<cfdi:Complemento>
<tfd:TimbreFiscalDigital xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/......." Version="1.1" UUID="123" FechaTimbrado="123" RfcProvCertif="123" SelloCFD="123" />
</cfdi:Complemento>
<cfdi:Addenda>
<ecb:EstadoDeCuentaBancario xmlns:ecb="http://schemas.reachcore.com/addendas/addenda-ecb/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.reachcore.com/........ http://go.reachcore.com/......." version="1.0">
<ecb:Movimientos>
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
<ecb:MovimientoECB fecha="123" referencia="123" descripcion="123" importe="123" moneda="123" saldoAlCorte="123" />
</ecb:Movimientos>
</ecb:EstadoDeCuentaBancario>
</cfdi:Addenda>
</cfdi:Comprobante>
PHP:
<?php
$xml = <<<EOD
-- Texto XML--
EOD;
$dom = new DOMDocument;
$dom->loadXML($xml);
foreach ($dom->getElementsByTagNameNS('*', '*') as $element){
echo 'local name: ', $element->localName, ', prefix: ', $element->prefix,"\n";
}
?>
Until now with this code I have been able to get the labels, but not the content of each <ecb:MovimientoECB>
greetings and thanks for your time and help