Package net.n3.nanoxml

Examples of net.n3.nanoxml.IXMLBuilder


    }
   
    @SuppressWarnings("unused")
    private String extractElementValue(IXMLElement parent, String name)
        throws TestSpecificationException {
        IXMLElement elem = name == null ? parent : parent.getFirstChildNamed(name);
        if (elem == null) {
            throw new TestSpecificationException(
                    "Element '" + name + "' not found in '" + parent.getName() + "'");
        } else {
            String res = elem.getContent();
            return (res == null) ? "" : res;
        }
    }
View Full Code Here


            return (res == null) ? "" : res;
        }
    }

    private String extractElementValue(IXMLElement parent, String name, String dflt) {
        IXMLElement elem = name == null ? parent : parent.getFirstChildNamed(name);
        String content = elem == null ? null : elem.getContent();
        return content == null ? dflt : content;
    }
View Full Code Here

        stmt.setString(1, day);
        ResultSet rs = stmt.executeQuery();

        while( rs.next() ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            if ( rs.getString("reporteZ").equals("0") ){
                 System.out.println("No se ha sacado el reporte Z de la impresora de la caja " + rs.getString("codigo_punto_de_venta"));
                 child.setAttribute("printer", ConnectionDrivers.getThisPrinterId( rs.getString("codigo_punto_de_venta")));
                 child.setAttribute("monto", "0");
                 child.setAttribute("reporteZ", "0");
                 child.setAttribute("lastR", "0");
                 child.setAttribute("numR", "0");
                 child.setAttribute("lastCN", "0");
                 child.setAttribute("numCN", "0");
            }else{
                child.setAttribute("printer", rs.getString("impresora") );
                child.setAttribute("monto", Shared.round(rs.getDouble("total_ventas")*(Shared.getIva()+100.0)/100.0,2) + "");
                child.setAttribute("reporteZ", rs.getString("numero_reporte_z"));
                child.setAttribute("lastR", rs.getString("codigo_ultima_factura"));
                child.setAttribute("numR", rs.getString("num_facturas"));
                child.setAttribute("lastCN", rs.getString("codigo_ultima_nota_credito"));
                child.setAttribute("numCN", rs.getString("numero_notas_credito"));
                System.out.println(" Reporte Z === "  + rs.getString("numero_reporte_z"));
            }
        }

        c.close();
View Full Code Here

        }
        if ( rs.getSize() > 0 ){
            CreditNoteGroup.add(rs);
        }

        IXMLElement xmlCN = new XMLElement("NotasDeCredito");

        for (ReceiptSap receiptSap : CreditNoteGroup) {
            IXMLElement child = xmlCN.createElement("CN");
            xmlCN.addChild(child);
            child.setAttribute("getId", receiptSap.getId());
            child.setAttribute("getKind", receiptSap.getKind());
            child.setAttribute("getClient", receiptSap.getClient());
            child.setAttribute("range", receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
            child.setAttribute("getZ", receiptSap.getZ());
            child.setAttribute("getPrinterId", receiptSap.getPrinterId());
            int position = 1;
            for (Receipt receipt : receiptSap.receipts) {
                for (Item2Receipt item2Receipt : receipt.getItems()) {
                    IXMLElement childchild = child.createElement("CND");
                    child.addChild(childchild);
                    childchild.setAttribute("id", "D" + receiptSap.getId());
                    childchild.setAttribute("position", Shared.df2intSAP.format(position++));
                    childchild.setAttribute("barcode", item2Receipt.getItem().getMainBarcode());
                    childchild.setAttribute("quant", item2Receipt.getQuant().toString());
                    childchild.setAttribute("sellUnits", item2Receipt.getItem().getSellUnits());
                    childchild.setAttribute("sellPrice", item2Receipt.getSellPrice()+"");
                    childchild.setAttribute("discount", (item2Receipt.getSellDiscount()/100.0)*item2Receipt.getSellPrice()+"");
                }

            }
            System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando Grupo = " + receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
        }
View Full Code Here

        }
        if ( rs.getSize() > 0 ){
            receiptGroup.add(rs);
        }

        IXMLElement xmlRe = new XMLElement("Facturas");

        for (ReceiptSap receiptSap : receiptGroup) {
            IXMLElement child = xmlRe.createElement("Re");
            xmlRe.addChild(child);
            child.setAttribute("getId", receiptSap.getId());
            child.setAttribute("getKind", receiptSap.getKind());
            child.setAttribute("getClient", receiptSap.getClient());
            child.setAttribute("range", receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
            child.setAttribute("getZ", receiptSap.getZ());
            child.setAttribute("getPrinterId", receiptSap.getPrinterId());

            int position = 1;
            for (Receipt receipt : receiptSap.receipts) {
                Double gDisc = receipt.getGlobalDiscount();
                for (Item2Receipt item2Receipt : receipt.getItems()) {
                    IXMLElement childchild = child.createElement("CND");
                    child.addChild(childchild);
                    childchild.setAttribute("id", "F" + receiptSap.getId());
                    childchild.setAttribute("position", Shared.df2intSAP.format(position++));
                    childchild.setAttribute("barcode", item2Receipt.getItem().getMainBarcode());
                    childchild.setAttribute("quant", item2Receipt.getQuant().toString());
                    childchild.setAttribute("sellUnits", item2Receipt.getItem().getSellUnits());
                    childchild.setAttribute("sellPrice", item2Receipt.getSellPrice()+"");
                    Double tmpD = (item2Receipt.getSellDiscount()/100.0)*item2Receipt.getSellPrice();
                    childchild.setAttribute("discount", tmpD + gDisc*(item2Receipt.getSellPrice()-tmpD) +"");
                }

            }
            System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " child = " +receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
        }
View Full Code Here

        TreeSet<String> clientsAdded = new TreeSet<String>();
        for (String c : clients) {
            Client cc = ConnectionDrivers.listClients(c).get(0);
            if ( !clientsAdded.contains(cc.getId()) ){
                IXMLElement client = clienXML.createElement("C");
                client.setAttribute("ID", cc.getId());
                String tname = cc.getName();
                client.setAttribute("Name", tname.substring(0,Math.min(35, tname.length())));
                String tc = cc.getAddress() + " Tlf: " + cc.getPhone();
                client.setAttribute("Addr", (tc).substring(0, Math.min(30,tc.length())));
                clienXML.addChild(client);
                clientsAdded.add(cc.getId());
            }
        }
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creado XML para clientes");
View Full Code Here

            }

            Shared.sendMail(Shared.getConfig("sendEmail"), createCloseEmail(), createCloseEmailSubject());


            IXMLElement data2Sent = new XMLElement("data");
            data2Sent.setAttribute("storeName", Shared.getConfig("storeName"));
            data2Sent.setAttribute("day", myDay);
            data2Sent.addChild(createXml4Receipt());
            data2Sent.addChild(createXml4CN());
            data2Sent.addChild(createClients());
            data2Sent.addChild(createHistEnvios());
            data2Sent.addChild(ConnectionDrivers.createFiscalData(myDay));
            data2Sent.addChild(createCobranzas());

            ByteArrayOutputStream baosF = new ByteArrayOutputStream();
            XMLWriter xmlwF = new XMLWriter(baosF);
            xmlwF.write(data2Sent);
View Full Code Here

    private javax.swing.JButton updateButton;
    // End of variables declaration//GEN-END:variables

    private IXMLElement createCobranzas() {
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XMl para cobranzas");
        IXMLElement xml = new XMLElement("Cobranza");

        // BANKS
        for ( int i = 0 ; i < bankTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            child.setAttribute("simbo", (bankTable.getValueAt(i, 0).toString().split("-")[0]).trim());

            if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("creditPaymentName")) ){
                child.setAttribute("mpago", "B");
            }else if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("debitPaymentName")) ){
                child.setAttribute("mpago", "D");
            }else if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("americanExpressPaymentName")) ){
                child.setAttribute("mpago", "A");
            }else{
                System.out.println("Banco desconocido... agregando E");
                child.setAttribute("mpago", "E");
            }

            child.setAttribute("bpago", (bankTable.getValueAt(i, 0).toString().split("-")[0]).trim());
            child.setAttribute("lote", (String)bankTable.getValueAt(i, 1));
            child.setAttribute("monto", ((Double)bankTable.getValueAt(i, 4))+"");
            child.setAttribute("text", "");
        }

        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XML para gastos");

        // EXPENSES
        for ( int i = 0 ; i < expenseTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            child.setAttribute("simbo", Shared.getConfig("genericBank"));

            String tmp = expenseTable.getValueAt(i, 0).toString().split("-")[0];
            child.setAttribute("mpago", tmp.substring(0, tmp.length() - 1));

            child.setAttribute("bpago", Shared.getConfig("genericBank"));
            child.setAttribute("lote", i+"");
            child.setAttribute("monto", ((String)expenseTable.getValueAt(i, 1)).replace(',', '.'));
            child.setAttribute("text", (String)expenseTable.getValueAt(i, 2));
           
        }

        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XML para efectivo");

        // CASH
        for ( int i = 0 ; i < depositTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            String bancoId = ((String)depositTable.getValueAt(i, 0)).split("-")[0].trim();
            child.setAttribute("simbo", bancoId);
            child.setAttribute("mpago", "E");

            child.setAttribute("bpago", bancoId);
            child.setAttribute("lote", ((String)depositTable.getValueAt(i, 1)));
            child.setAttribute("monto", ((String)depositTable.getValueAt(i, 2)).replace(',','.'));
            child.setAttribute("text", "");

        }
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " XML Creados satisfactoriamente");
        return xml;
    }
View Full Code Here

  public void load(Reader rdr, ClassLoader cl) throws XMLException
  {
    try
    {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      parser.setReader(new StdXMLReader(rdr));
      IXMLElement element = (IXMLElement) parser.parse();
      // Bug 2942351 (Program doesn't launch)
      // looking at the source for StdXMLBuilder, it appears that parser.parse() could possibly return
      // null.  So check for null here and skip if necessary.
      if (element != null)
      {
View Full Code Here

        if (log.isDebugEnabled())
            log.debug(new String(out.toByteArray()));
        // #endif

        try {
            IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
            IXMLReader reader = StdXMLReader.stringReader(new String(out.toByteArray(), "UTF8")); //$NON-NLS-1$
            parser.setReader(reader);
            IXMLElement rootElement = (IXMLElement) parser.parse();

            if (!rootElement.getName().equalsIgnoreCase("multistatus")) //$NON-NLS-1$
                throw new IOException(Messages.getString("MultiStatusResponse.invalidDavRootElement") + rootElement.getName()); //$NON-NLS-1$

            // Now process the responses
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.IXMLBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.