Package de.pdark.decentxml

Examples of de.pdark.decentxml.Element


            LOG.debug("Property not supported: {}", e);
        }

        Object value = model.marshalRootElement();
        Document doc = model.getDoc();
        Element docElem = doc.getRootElement();

        // JAXB only seems to do nice whitespace/namespace stuff when writing to stream
        // rather than DOM directly
        // marshaller.marshal(value, docElem);

        StringWriter buffer = new StringWriter();
        marshaller.marshal(value, buffer);

        // now lets parse the XML and insert the root element into the doc
        String xml = buffer.toString();
        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")) {
            camelDoc.getRootElement().setName("routeContext");
        }
        if (model.isJustRoutes()) {
            replaceChild(doc, camelElem, docElem);
        } else {
            if (model.getNode() != null) {
                replaceCamelElement(docElem, camelElem, model.getNode());
            } else {
                docElem.addNode(camelElem);
            }
        }
    }
View Full Code Here


    }
   
    InputStream is = getResource(resourcesPrefix, tplXml);
    String xmlText = readStreamToString(is, true, tplXml, tplVars);
    Document doc = XMLParser.parse(xmlText);
    Element root = doc.getRootElement();
    Resource project = processResource(resourcesPrefix, root, tplVars, null);
    return project;
  }
View Full Code Here

 
  public static Resource read(String tplXml, Map<String, Object> tplVars) throws IOException {
    InputStream is = getResource(tplXml);
    String xmlText = readStreamToString(is, true, tplXml, tplVars);
    Document doc = XMLParser.parse(xmlText);
    Element root = doc.getRootElement();
    Resource project = processResource(root, tplVars, null);
    return project;
  }
View Full Code Here

TOP

Related Classes of de.pdark.decentxml.Element

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.