mercredi 8 février 2017

Read specific data from XML using Java (DOM)

Vote count: 0

I want to extrat some data from an invoice (XML) using Java. I'm using the example on this link (http://ift.tt/2ksu9JW) The problem is my XML doesn't look like the one in the example, here is mine:

<?xml version="1.0" encoding="UTF-8"?> <cfdi:Comprobante xmlns:cfdi="http://ift.tt/UMOQdM" xmlns:bfa2="http://ift.tt/2ksoT8U" xmlns:xsi="http://ift.tt/ra1lAU" NumCtaPago="4007" LugarExpedicion="CUAJIMALPA DE MORELOS,CIUDAD DE MEXICO" metodoDePago="99" tipoDeComprobante="ingreso" total="2490" subTotal="2146.55" fecha="2016-12-14T10:23:08" folio="57318" serie="BT" version="3.2" xsi:schemaLocation="http://ift.tt/UMOQdM http://ift.tt/U86xac http://ift.tt/2ksoT8U http://ift.tt/2kIn7zi"> <cfdi:Emisor nombre="BEST BUY STORES S. DE R.L. DE C.V." rfc="BBS070606D33"> <cfdi:DomicilioFiscal codigoPostal="05348" pais="MEXICO" estado="CIUDAD DE MEXICO" municipio="CUAJIMALPA DE MORELOS" referencia="EDIFICIO CENTURY PLAZA" colonia="SANTA FE CUAJIMALPA" noInterior="PISO 2 OFNA 202 Y 203 P3 Y P4" noExterior="440" calle="AV. SANTA FE" /> <cfdi:ExpedidoEn codigoPostal="05348" pais="MEXICO" estado="CIUDAD DE MEXICO" municipio="CUAJIMALPA DE MORELOS" colonia="SANTA FE" calle="AVENIDA SANTA FE NO. 440 PISO 2 (OFICINA 203 Y 204),PISO 3 Y PISO 4" /> <cfdi:RegimenFiscal Regimen="Regimen General de Ley Personas Morales" /> </cfdi:Emisor> <cfdi:Receptor nombre="VIALCOMA S.A DE C.V" rfc="VIA8011248W0"> <cfdi:Domicilio codigoPostal="54080" pais="México" estado="Estado de México" municipio="Tlalnepantla de Baz" referencia="VIALCOMA S.A. de C.V." localidad="Tlalnepantla de Baz" colonia="EL MIRADOR" noExterior="107" calle="AV. GUSTAVO BAZ " /> </cfdi:Receptor> <cfdi:Conceptos> <cfdi:Concepto importe="2146.55" valorUnitario="2146.55" descripcion="PANASONIC PHONE KX-PRD260MEB" noIdentificacion="000000001000189023" unidad="PZA" cantidad="1" /> </cfdi:Conceptos> <cfdi:Impuestos totalImpuestosTrasladados="343.45"> <cfdi:Traslados> <cfdi:Traslado importe="343.45" tasa="16.0" impuesto="IVA" /> </cfdi:Traslados> </cfdi:Impuestos> <cfdi:Complemento> <tfd:TimbreFiscalDigital xmlns:tfd="http://ift.tt/1hmMRf8" xsi:schemaLocation="http://ift.tt/1hmMRf8 http://ift.tt/2kIw2k8" UUID="2e36935c-4948-4f7b-9b29-477546aa2922" version="1.0" /> </cfdi:Complemento> <cfdi:Addenda> <bfa2:AddendaBuzonFiscal version="2.0"> <bfa2:Receptor email="" /> <bfa2:TipoDocumento descripcion="Factura" nombreCorto="FAC" /> <bfa2:CFD totalConLetra="Dos mil cuatrocientos noventa pesos 00/100 M.N." fechaEnvio="2016-12-12T10:42:15-06:00" /> <bfa2:Extra valor="02028001014520161212" atributo="numTicket" /> </bfa2:AddendaBuzonFiscal> </cfdi:Addenda> </cfdi:Comprobante>

I want to get (print on console) the data on "folio" "serie" and "UUID"

Can someone help me please?

asked 10 secs ago

Let's block ads! (Why?)



Read specific data from XML using Java (DOM)

Aucun commentaire:

Enregistrer un commentaire