Package net.n3.nanoxml

Examples of net.n3.nanoxml.NonValidator


    }
   
    @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

  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

     XMLElement el = null;
     boolean fileMissing = false;
     try {
       try{
         try {
           IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
           // IXMLReader reader = StdXMLReader.fileReader(file); // fails on pc
           BufferedReader breader = new BufferedReader(new FileReader(file));
           IXMLReader reader = new StdXMLReader(breader);
           parser.setReader(reader);
           el = (XMLElement) parser.parse();
           if (el == null) {
             el = promptToOverwrite(xmlFile, tag);
           } else {
             LogBuffer.println("created xml config from file " + file);
           }
View Full Code Here

        cbuf[0] = (char) ch;
        xmlText = xmlText + new String(cbuf);
        ch = st.read();
      }
IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
Reader breader = new StringReader(xmlText);
IXMLReader reader = new StdXMLReader(breader);
parser.setReader(reader);
el = (XMLElement) parser.parse();
      return el;
    }
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.NonValidator

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.