Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/12/2018, 00:19
herwex
 
Fecha de Ingreso: agosto-2011
Ubicación: d.f
Mensajes: 283
Antigüedad: 12 años, 8 meses
Puntos: 4
Leer el UUID de un xml

Hola a todos, tengo el siguiente problema.

En mi trabajo tenemos que leer mas de 8,000 facturas (Mexico) en formato (.xml), hasta el momento llevo esto.

Código PHP:
public void analizaArchivo(List addArchthrows JDOMException {
        for (
int j 0addArch.size(); j++) {
            
SAXBuilder builder = new SAXBuilder();
            
File xmlFile = new File("D:\\factura\\".concat(addArch.get(j).toString()));
            try {
                
Document document = (Documentbuilder.build(xmlFile);
                
                
Element rootNode document.getRootElement();
                
Parent rootNode2 = (Parentdocument.getParent();
                
                List 
miembros rootNode.getChildren();
                
System.out.println("lo que tiene miembros " miembros.size());
                
                for (
int i 0miembros.size(); i++) {
                    
Element yeah = (Elementmiembros.get(i);
                    
System.out.println("Nombre de los nodos hijos: " yeah.getName());
                    if (
yeah.getName().equals("Emisor")) {
                        
System.out.println("Nombre" " : "
                                
yeah.getAttributeValue("Nombre"));
                        
System.out.println("RFC: : "
                                
yeah.getAttributeValue("Rfc"));
                    }
                     if (
yeah.getName().equals("Complemento")) {
                            
System.out.println("UUID"+yeah.getAtributeValue("UUID");
                 }
               }
            } catch (
IOException e) {
                
e.printStackTrace();
            }
        } 
Cuando entro a las propiedades del nodo Emisor las muestra, sin embargo cuando quiero entrar a las propiedades del nodo Complemento efectivamente entra a ese if pero no me imprime nada en consola en System.out.println("UUID"+yeah.getAtributeValue("U UID"); me imprime null, y es ahi donde no se por que!!!

Anexo el codigo del xml (son datos de prueba)

Código PHP:
<?xml version="1.0" encoding="utf-8" ?>
<cfdi:Comprobante Certificado="7V2ooqFhkbOw==" Fecha="2018-11-30T16:13:29" FormaPago="01" LugarExpedicion="66600" MetodoPago="PUE" Moneda="MXN" NoCertificado="00001000000401553715" Sello="EEvMBBXIkNsgMIpqumRjcgIBQ==" Serie="K" SubTotal="82.76" TipoDeComprobante="I" Total="96.00" Version="3.3" xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:fm="http://facturame.mx/ns/addenda/1" xmlns:tdCFDI="http://www.mx/sitio_internet/cfd/tipoDatos/tdCFDI" xmlns:tfd="http://www.mx/TimbreFiscalDigital" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.mx/sitio_internet/cfd/3/cfdv33.xsd" Folio="138003">
    <cfdi:Emisor Nombre="MERCADO A, S.A. DE C.V." RegimenFiscal="601" Rfc="AMA940815LT8"/>
    <cfdi:Receptor Nombre="servicios" Rfc="ESF110326JK9" UsoCFDI="G03"/>
    <cfdi:Conceptos>
        <cfdi:Concepto Cantidad="1" ClaveProdServ="78111807" ClaveUnidad="E48" Descripcion="Pago de Estacionamiento" Importe="82.76" NoIdentificacion="000-00001" ValorUnitario="82.76">
            <cfdi:Impuestos>
                <cfdi:Traslados>
                    <cfdi:Traslado Base="82.76" Importe="13.24" Impuesto="002" TasaOCuota="0.160000" TipoFactor="Tasa"/>
                </cfdi:Traslados>
            </cfdi:Impuestos>
        </cfdi:Concepto>
    </cfdi:Conceptos>
    <cfdi:Impuestos TotalImpuestosTrasladados="13.24">
        <cfdi:Traslados>
            <cfdi:Traslado Importe="13.24" Impuesto="002" TasaOCuota="0.160000" TipoFactor="Tasa"/>
        </cfdi:Traslados>
    </cfdi:Impuestos>
    <cfdi:Complemento>
        <tfd:TimbreFiscalDigital xmlns:tfd="/TimbreFiscalDigitalv11.xsd" Version="1.1" UUID="7addb0a5-862d-46fa-8168-7ae5f0a8e530" RfcProvCertif="DIA031002LZ2" FechaTimbrado="2018-11-30T16:13:29" SelloCFD="pqumRjcgIBQ==" NoCertificadoSAT="11121000000325614689" SelloSAT="998edJbsIEzZ5pkFnRIQ=="/>
    </cfdi:Complemento>
</cfdi:Comprobante>
Alguien que me pueda echar la mano, se lo agradeceria!!!

Última edición por herwex; 19/12/2018 a las 00:26