Package de.pdark.decentxml

Examples of de.pdark.decentxml.Node


      if (parentNode!=null) {
        List<Node> allChildNodes = parentNode.getNodes();
        boolean nonTextChild = false;
        for (Iterator<Node> it = allChildNodes.iterator(); it
            .hasNext();) {
          Node node = it.next();
          if (node.getType()!=Type.TEXT) {
            nonTextChild = true;
          }         
        }
        if (!nonTextChild) {
          for (Iterator<Node> it = allChildNodes.iterator(); it
              .hasNext();) {
            Node node = it.next();
            it.remove();
          }
          if (!parentNode.hasNodes()) {
            parentNode.setCompactEmpty(true);
          }
View Full Code Here


            int n = nodes.size();
            if (n != 0) {
                if (n > 1) {
                    Activator.getLogger().warning(message + " contains " + n + " <" + pair[1] + "> elements. Only the first one will be used");
                }
                Node node = nodes.get(0);
                found.add(node);
            }
        }

        if (found.size() > 0) {
            Node n = found.get(0);
            if (n != null) {
                String ns = getNamespaceURI(n);
                Node parseNode;
                if (!ns.equals(springNS)) {
                    parseNode = cloneAndReplaceNamespace(n, ns, springNS);
                } else {
                    parseNode = n;
                }
View Full Code Here

        }
        return null; // ?
    }

    protected Node cloneAndReplaceNamespace(Node node, String oldNS, String newNS) {
        Node answer = node.copy();
        return replaceNamespace(answer, oldNS, newNS);
    }
View Full Code Here

        if (!model.getNs().equals(springNS)) {
            // !!!
            xml = xml.replaceAll(springNS, model.getNs());
        }
        Document camelDoc = parse(new XMLStringSource(xml));
        Node camelElem = camelDoc.getRootElement();

        // TODO
        //val camelElem = doc.importNode(element, true)

        if (model.isRoutesContext() && camelDoc.getRootElement().getName().equals("camelContext")) {
View Full Code Here

        return answer;
    }

    public static String nodeWithNamespacesToText(Node parseNode, Element namespacesNode) throws IOException {
        // we need to add any namespace prefixes defined in the root directory
        Node copy = parseNode.copy();
        if (copy instanceof Element && parseNode instanceof Element) {
            moveCommentsIntoDescriptionElements((Element) copy, (Element) parseNode);
            addParentNamespaces((Element) copy, namespacesNode.getParent());
        }
        return xmlToText(copy);
View Full Code Here

        return answer;
    }

    public static String nodeWithNamespacesToText(Node parseNode, Element namespacesNode) throws IOException {
        // we need to add any namespace prefixes defined in the root directory
        Node copy = parseNode.copy();
        if (copy instanceof Element && parseNode instanceof Element) {
            moveCommentsIntoDescriptionElements((Element) copy, (Element) parseNode);
            addParentNamespaces((Element) copy, namespacesNode.getParent());
        }
        return xmlToText(copy);
View Full Code Here

            int n = nodes.size();
            if (n != 0) {
                if (n > 1) {
                    LOG.warn(message + " contains " + n + " <" + pair[1] + "> elements. Only the first one will be used");
                }
                Node node = nodes.get(0);
                found.add(node);
            }
        }

        if (found.size() > 0) {
            Node n = found.get(0);
            if (n != null) {
                String ns = getNamespaceURI(n);
                Node parseNode;
                if (!ns.equals(springNS)) {
                    parseNode = cloneAndReplaceNamespace(n, ns, springNS);
                } else {
                    parseNode = n;
                }
View Full Code Here

        }
        return null; // ?
    }

    protected Node cloneAndReplaceNamespace(Node node, String oldNS, String newNS) {
        Node answer = node.copy();
        return replaceNamespace(answer, oldNS, newNS);
    }
View Full Code Here

        if (!model.getNs().equals(springNS)) {
            // !!!
            xml = xml.replaceAll(springNS, model.getNs());
        }
        Document camelDoc = parse(new XMLStringSource(xml));
        Node camelElem = camelDoc.getRootElement();

        // TODO
        //val camelElem = doc.importNode(element, true)

        if (model.isRoutesContext() && camelDoc.getRootElement().getName().equals("camelContext")) {
View Full Code Here

TOP

Related Classes of de.pdark.decentxml.Node

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.