Examples of DOMDocument


Examples of dom.DOMDocument

    if (DebugFile.trace) {
      DebugFile.writeln("Begin QueryByForm.parseURI(" + sURI + "," + sEncoding + ")");
      DebugFile.incIdent();
    }

    oXMLDoc = new DOMDocument();
    try {
      oXMLDoc.parseURI(sURI, sEncoding);
    }
    catch (Exception xcpt) {
      oXMLDoc = null;
View Full Code Here

Examples of org.apache.tools.ant.gui.xml.DOMDocument

        ACSProjectElement project = null;
        try {
            DOMNodeManager manager =
                new DOMNodeManager(_elementMap);
           
            DOMDocument doc = manager.parse(stream);
            project = (ACSProjectElement) doc.getDocumentElement();
           
        } catch (SAXException se) {
            se.printStackTrace();
            throw new IOException(se.getMessage());
        } catch (ParserConfigurationException pce) {
View Full Code Here

Examples of org.atabaque.utils.xml.DOMDocument

       
        System.out.println(ConfigFile.getKey("MSG_BUILDING"));
        System.out.println(ConfigFile.getKey("MSG_SOURCE") + inputPath);
        System.out.println(ConfigFile.getKey("MSG_DESTINATION") + outputPath);
       
        DOMDocument doc = new DOMDocument(PROC_PATH + PROCESS_FILENAME);
       
        String processId = doc.getAttributeValue(ELEM_PROCESS, ELEM_ID);
        String processName = doc.getAttributeValue(ELEM_PROCESS, ELEM_NAME);
        String processVersion = doc.getAttributeValue(ELEM_PROCESS, ELEM_VERSION);
       
        // Starts the creation of a Unique
        StringBuffer process = new StringBuffer();
        process.append("<?xml version=\"1.0\" encoding=\"" + ConfigFile.getProperty("CHARSET_ENCODING") + "\"?>\n");
        process.append("<" + ELEM_PROCESS + " " + ELEM_ID + "=\"" + processId + "\" " +
            ELEM_NAME + "=\"" + processName + "\" " + ELEM_VERSION + "=\"" + processVersion + "\">\n");

        NodeList nodeList = doc.selectNodes("*");
        for (int i=0; i<nodeList.getLength(); i++) {
            Element e = (Element) nodeList.item(i);
           
            String id = e.getAttribute(ELEM_ID);
            String name = e.getAttribute(ELEM_NAME);
            String folder = e.getAttribute(ELEM_FOLDER);
            String type = e.getAttribute(ELEM_TYPE);
            String xml = FileUtil.addExt(e.getAttribute(ELEM_XML), XML_EXT);
            String xsl = FileUtil.addExt(e.getAttribute(ELEM_XSL), XSL_EXT);
            String xsl2 = FileUtil.addExt(e.getAttribute(ELEM_XSL2), XSL_EXT);
            String html = FileUtil.addExt(e.getAttribute(ELEM_HTML), HTML_EXT);
            String obs = e.getAttribute(ELEM_OBS);
            String append = e.getAttribute(ELEM_APPEND);
           
            System.out.print("    " + name);
           
            if (type.equals("xml")) {
                String folderName = folder;
                if (folderName.equals("") || folderName.equals("."))
                    folderName = doc.getRoot().getNodeName();
               
                String xmlFileName = (xml.equals("")) ? folderName : xml;
                String xslFileName = (xsl.equals("")) ? xmlFileName : xsl;
                String htmlFileName = (html.equals("")) ? xslFileName : html;
               
                String xmlFile = (i==0?PROC_PATH:XML_PATH) + xmlFileName;
                xmlFile = FileUtil.addExt(xmlFile, XML_EXT);
                String xslFile = XSL_PATH + xslFileName;
                String optionalFolder = "";
                if (!folder.equals("."))
                    optionalFolder = folderName + FILE_SEP;
                String htmlFile = outputPath + optionalFolder + htmlFileName;
               
                FileUtil.createDir(outputPath + folder);
               
                System.out.println(" (" + xml + " -> " + optionalFolder + htmlFileName + ")...");
               
                // Second Transformation
                if (xsl2.equals("")) {
                    if (xmlFile.indexOf("*") > -1) { // It's a wildcard
                        File[] f = FileUtil.listDir(xmlFile);
                        boolean useFileNameAsOutputFolder = false;
                        if (optionalFolder.indexOf("*") > -1) { // Optional Folder is also a wildcard
                            useFileNameAsOutputFolder = true;
                        }
                        for (int index=0; index<f.length; index++) {
                            String filename = f[index].getName();
                            String xmlfile = f[index].getPath().toString();
                            String prefix = "";
                            if (html.indexOf("*") != -1) {
                                prefix = html.substring(0, html.indexOf("*"));
                            }
                            if (useFileNameAsOutputFolder)
                                optionalFolder = filename + FILE_SEP;

                            String htmlfile = outputPath + optionalFolder + prefix + FileUtil.removeExt(filename) + HTML_EXT;

                            System.out.println("      " + filename + " -> " + optionalFolder + prefix + FileUtil.removeExt(filename) + HTML_EXT + "...");

                            XMLUtil.transform(DTD_PATH, xmlfile, xslFile, htmlfile);
                            if (i>0) {
                                if (!append.toLowerCase().equals("false")) {
                                    DOMDocument xmlDoc = new DOMDocument(xmlfile);
                                    if (xmlDoc.isLoaded())
                                        process.append(xmlDoc.getXML());
                                }
                            }
                        }
                    } else {
                        XMLUtil.transform(DTD_PATH, xmlFile, xslFile, htmlFile);
                        if (i>0) {
                            if (!append.toLowerCase().equals("false")) {
                                DOMDocument xmlDoc = new DOMDocument(xmlFile);                               
                                if (xmlDoc.isLoaded())
                                    process.append(xmlDoc.getXML());
                            }
                        }
                    }
                } else {
                    String tempFile = XSL_PATH + xsl2+ TEMP_EXT;
View Full Code Here

Examples of org.camunda.bpm.model.xml.instance.DomDocument

    return referenceSourceType;
  }

  @SuppressWarnings("unchecked")
  private Collection<DomElement> getView(ModelElementInstanceImpl referenceSourceParentElement) {
    DomDocument document = referenceSourceParentElement.getModelInstance().getDocument();
    Collection<Source> referenceSourceElements = referenceSourceCollection.get(referenceSourceParentElement);
    Collection<DomElement> referenceTargetElements = new ArrayList<DomElement>();
    for (Source referenceSourceElement : referenceSourceElements) {
      String identifier = getReferenceIdentifier(referenceSourceElement);
      DomElement referenceTargetElement = document.getElementById(identifier);
      if (referenceTargetElement != null) {
        referenceTargetElements.add(referenceTargetElement);
      }
      else {
        throw new ModelException("Unable to find a model element instance for id " + identifier);
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

   * @return the marshalled DOM4J {@link org.dom4j.Element}
   * @throws JAXBException when an error occurs
   */
  protected org.dom4j.Element marshal(javax.xml.bind.Element element)
      throws JAXBException {
    DOMDocument doc = new DOMDocument();
    getMarshaller().marshal(element, doc);

    return doc.getRootElement();
  }
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

   */
  private StringBuilder render(Element node) {
    try {
      Document doc = node.getDocument();
      if (doc == null) {
        doc = new DOMDocument();
        doc.add(node);
      }
      DocumentSource xmlsource = new DocumentSource(node);
     
      //ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

            return (Document) src;
        }
        else if (src instanceof org.dom4j.Document)
        {
            org.dom4j.Document dom4j = (org.dom4j.Document) src;
            DOMDocument dom = new DOMDocument();
            dom.setDocument(dom4j);
            return dom;
        }
        else if (src instanceof OutputHandler)
        {
            OutputHandler handler = ((OutputHandler) src);
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

    @Test
    public void testXPathCache() throws JaxenException
    {
        XPathExpressionEvaluator xPathExpressionEvaluator = new XPathExpressionEvaluator();
        XPath xPathDOM1 = xPathExpressionEvaluator.getXPath(EXPRESSION, new DOMDocument());
        assertTrue(xPathDOM1 instanceof DOMXPath);
        XPath xPathDOM2 = xPathExpressionEvaluator.getXPath(EXPRESSION, new DOMDocument());
        assertTrue(xPathDOM2 == xPathDOM1);
        XPath xPathDom4j3 = xPathExpressionEvaluator.getXPath(EXPRESSION, new DefaultDocument());
        assertTrue(xPathDom4j3 instanceof Dom4jXPath);
        assertTrue(xPathDOM1 != xPathDom4j3);
        XPath xPathDOM3 = xPathExpressionEvaluator.getXPath(OTHER_EXPRESSION, new DOMDocument());
        assertTrue(xPathDOM1 != xPathDOM3);
    }
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

    @Override
    public void doStatus(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
            throws ServletException
    {

        DOMDocument report = new DOMDocument();
        DOMElement testsuite = new DOMElement("testsuite");
        report.setRootElement(testsuite);
        testsuite.addAttribute("name", _testSuiteClassName);
        testsuite.addAttribute("errors", Integer.toString(_errorTests.size()));
        testsuite.addAttribute("failures", Integer.toString(_failedTests.size()));
        testsuite.addAttribute("hostname", request.getServerName());
        testsuite.addAttribute("tests", Integer.toString((_testResult != null) ? _testResult.runCount() : 0));
View Full Code Here

Examples of org.dom4j.dom.DOMDocument

    @Override
    public void doStatus(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
            throws ServletException
    {

        DOMDocument report = new DOMDocument();
        DOMElement testsuite = new DOMElement("testsuite");
        report.setRootElement(testsuite);
        testsuite.addAttribute("name", _testSuiteClassName);
        testsuite.addAttribute("errors", Integer.toString(_errorTests.size()));
        testsuite.addAttribute("failures", Integer.toString(_failedTests.size()));
        testsuite.addAttribute("hostname", request.getServerName());
        testsuite.addAttribute("tests", Integer.toString((_testResult != null) ? _testResult.runCount() : 0));
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.