This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mx.hash.xml2json; | |
import java.io.IOException; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.xml.parsers.ParserConfigurationException; | |
import javax.xml.transform.TransformerException; | |
import org.xml.sax.SAXException; | |
public class App { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mx.hash.xml2json; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.StringWriter; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import javax.xml.transform.Transformer; | |
import javax.xml.transform.TransformerConfigurationException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File archivo = new File(file); | |
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); | |
// Esto es para agilizar la lectura de archivos grandes | |
documentBuilderFactory.setNamespaceAware(false); | |
documentBuilderFactory.setValidating(false); | |
documentBuilderFactory.setFeature("http://xml.org/sax/features/namespaces", false); | |
documentBuilderFactory.setFeature("http://xml.org/sax/features/validation", false); | |
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); | |
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define 👍 0; | |
void 😸😸😸😸😸() { | |
printf("😸 Miau\n"); | |
} | |
void 😲() { | |
printf("😲 Esto funciono!!! 😲\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mx.hash.xmlreader; | |
import java.io.File; | |
import java.io.IOException; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; | |
import javax.xml.xpath.XPath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd" Version="3.3" Serie="A" Folio="01" Fecha="2017-11-02T10:47:43" Sello="i4+8eOTrwoJQSEU5/LycHBGgis4u9BomXnAFPQCvclo/orIPtmL98k7RA7SNWXgH/9L1Rum/xqjGmerR4o0BO0CBtK16v3riBEwO92VlYbM9rWzd+K9R4uSqtctMd1vQumWf7ssmRytNRprjXuD2itCdxMKgqHg7+rreGV1WU1g=" FormaPago="03" NoCertificado="20001000000200000192" Certificado="MIIERjCCAy6gAwIBAgIUMjAwMDEwMDAwMDAyMDAwMDAxOTIwDQYJKoZIhvcNAQEFBQAwggFcMRowGAYDVQQDDBFBLkMuIDIgZGUgcHJ1ZWJhczEvMC0GA1UECgwmU2VydmljaW8gZGUgQWRtaW5pc3RyYWNpw7NuIFRyaWJ1dGFyaWExODA2BgNVBAsML0FkbWluaXN0cmFjacOzbiBkZSBTZWd1cmlkYWQgZGUgbGEgSW5mb3JtYWNpw7NuMSkwJwYJKoZIhvcNAQkBFhphc2lzbmV0QHBydWViYXMuc2F0LmdvYi5teDEmMCQGA1UECQwdQXYuIEhpZGFsZ28gNzcsIENvbC4gR3VlcnJlcm8xDjAMBgNVBBEMBTA2MzAwMQswCQYDVQQGEwJNWDEZMBcGA1UECAwQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// XPath nos permite seleccionar objetos via su ubicacion en la estructura del XML | |
XPath xPath = XPathFactory.newInstance().newXPath(); | |
// La ruta del elemento que deseamos, para este omitir el prefijo cfdi: | |
String expresionTranslados = "/Comprobante/Impuestos/Traslados/Traslado"; | |
// Obtenemos todos los nodos que empatan con la ruta que indicamos | |
NodeList nodeListTranslados = (NodeList) xPath.compile(expresionTranslados).evaluate(documento, XPathConstants.NODESET); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
documentBuilderFactory.setNamespaceAware(false); | |
documentBuilderFactory.setValidating(false); | |
documentBuilderFactory.setFeature("http://xml.org/sax/features/namespaces", false); | |
documentBuilderFactory.setFeature("http://xml.org/sax/features/validation", false); | |
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); | |
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mx.ticom.poolconexiones; | |
import java.beans.PropertyVetoException; | |
import java.io.IOException; | |
import java.sql.Connection; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mx.ticom.poolconexiones; | |
import com.mchange.v2.c3p0.ComboPooledDataSource; | |
import java.beans.PropertyVetoException; | |
import java.io.IOException; | |
import java.sql.Connection; | |
import java.sql.SQLException; | |
public class PoolC3P0 { | |
// Notara que el pool es un miembro *estatico* esto es para evitar duplicidad |