Examples of IXMLElement


Examples of net.n3.nanoxml.IXMLElement

        if (element.getFirstChildNamed("href", element.getNamespace()) == null) //$NON-NLS-1$
            throw new IOException(Messages.getString("MultiStatusResponse.unexpectedHref")); //$NON-NLS-1$

        href = URLUTF8Encoder.decode(element.getFirstChildNamed("href", element.getNamespace()).getContent()); //$NON-NLS-1$

        IXMLElement props = element.getFirstChildNamed("propstat", element.getNamespace()); //$NON-NLS-1$

        if (props == null)
            throw new IOException(Messages.getString("MultiStatusResponse.noPropertyElements")); //$NON-NLS-1$

        if (props.getFirstChildNamed("status", element.getNamespace()) == null) //$NON-NLS-1$
            throw new IOException(Messages.getString("MultiStatusResponse.unexpectedStatusResponse")); //$NON-NLS-1$

        String status = props.getFirstChildNamed("status", element.getNamespace()).getContent(); //$NON-NLS-1$

        StringTokenizer tokens = new StringTokenizer(status, " ", false); //$NON-NLS-1$
        reason = ""; //$NON-NLS-1$

        try {
            version = tokens.nextToken();
            this.status = Integer.parseInt(tokens.nextToken());

            while (tokens.hasMoreTokens()) {
                reason += tokens.nextToken() + " "; //$NON-NLS-1$
            }
            reason = URLDecoder.decode(reason.trim());
        } catch (NoSuchElementException e) {
            throw new IOException(Messages.getString("MultiStatusResponse.failedToReadHTTPResponseHeader")); //$NON-NLS-1$
        } catch (NumberFormatException e) {
            throw new IOException(Messages.getString("MultiStatusResponse.failedToReadHTTPResponseHeader")); //$NON-NLS-1$
        }

        // Create a new set of properties
        properties = new Properties();

        // Check the status, if its not found then return
        if (this.status == 404)
            return;

        props = props.getFirstChildNamed("prop", props.getNamespace()); //$NON-NLS-1$

        if (props == null)
            throw new IOException(Messages.getString("MultiStatusResponse.noPropElementsInPropStat")); //$NON-NLS-1$

        IXMLElement child;

        for (Enumeration e = props.getChildren().elements(); e.hasMoreElements();) {
            child = (IXMLElement) e.nextElement();

            if (child.getName().equalsIgnoreCase("resourcetype")) { //$NON-NLS-1$
                if (child.getChildrenNamed("collection") != null) //$NON-NLS-1$
                    collection = true;
            } else {
                properties.put(child.getName().toLowerCase(), child.getContent() == null ? "" : child.getContent()); //$NON-NLS-1$
            }
        }

    }
View Full Code Here

Examples of net.n3.nanoxml.IXMLElement

        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
            Vector children = rootElement.getChildrenNamed("response", rootElement.getNamespace()); //$NON-NLS-1$
            Vector responses = new Vector();

            for (Enumeration e = children.elements(); e.hasMoreElements();) {
                responses.addElement(new MultiStatusResponse((IXMLElement) e.nextElement()));
            }
View Full Code Here

Examples of net.n3.nanoxml.IXMLElement

      return ret;
  }
 
  public ConfigNode fetchFirst(String string) {
      if (root == null) return null;
      IXMLElement kid = root.getFirstChildNamed(string);
      if (kid == null) return null;
      return new XmlConfigNode(kid);
  }
View Full Code Here

Examples of net.n3.nanoxml.IXMLElement

        throws Exception {
        StdXMLReader xr = new StdXMLReader(in);
        IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
        parser.setReader(xr);
        TestSetSpecification res;
        IXMLElement root = (IXMLElement) parser.parse();
        if (root.getName().equals("testSpec")) {
            res = new TestSetSpecification("", base);
            res.addTestSpec(parseTestSpecification(root));
        } else if (root.getName().equals("testSet")) {
            String title = extractAttribute(root, "title");
            res = new TestSetSpecification(title, base);
            for (Object obj : root.getChildren()) {
                if (obj instanceof IXMLElement) {
                    IXMLElement argChild = (IXMLElement) obj;
                    String name = argChild.getName();
                    if (name.equals("testSpec")) {
                        // (directly recursive)
                        res.addTestSpec(parseTestSpecification(argChild));
                    } else if (name.equals("plugin")) {
                        res.addPluginSpec(parsePluginSpecification(argChild));
View Full Code Here

Examples of net.n3.nanoxml.IXMLElement

        TestSpecification res = new TestSpecification(
                runMode, command, scriptContent, inputContent, outputContent, errorContent,
                title, rc, exception);
        for (Object obj : elem.getChildren()) {
            if (obj instanceof IXMLElement) {
                IXMLElement child = (IXMLElement) obj;
                String name = child.getName();
                if (name.equals("arg")) {
                    res.addArg(child.getContent());
                } else if (name.equals("plugin")) {
                    res.addPlugin(parsePluginSpecification(child));
                } else if (name.equals("file")) {
                    parseFile(child, res);
                }
View Full Code Here

Examples of net.n3.nanoxml.IXMLElement

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

Examples of net.n3.nanoxml.IXMLElement

            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

Examples of net.n3.nanoxml.IXMLElement

        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

Examples of net.n3.nanoxml.IXMLElement

        }
        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

Examples of net.n3.nanoxml.IXMLElement

        }
        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
TOP
Copyright © 2018 www.massapi.com. 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.