Package org.dom4j

Examples of org.dom4j.Document.selectSingleNode()


                debugDoc = (Document) debugDocuments.get(idx);
                out.write("<tr>");
                out.write("<td>" + String.valueOf(idx) + "</td>");
                out.write("<td><a target=\"blank\" href=\"" + getContextPath() + "/tmlDebug?command=showModules&index=" + idx + "\">" + debugDoc.selectSingleNode("/tmldebugdocument/@url").getText()
                        + "</a></td>");
                out.write("<td>" + debugDoc.selectSingleNode("/tmldebugdocument/@started").getText() + "");
                out.write("<td>");
                Attribute endedElement = (Attribute) debugDoc.selectSingleNode("/tmldebugdocument/@ended");
                if (endedElement != null) {
                    out.write(endedElement.getText());
                }
View Full Code Here


                out.write("<td>" + String.valueOf(idx) + "</td>");
                out.write("<td><a target=\"blank\" href=\"" + getContextPath() + "/tmlDebug?command=showModules&index=" + idx + "\">" + debugDoc.selectSingleNode("/tmldebugdocument/@url").getText()
                        + "</a></td>");
                out.write("<td>" + debugDoc.selectSingleNode("/tmldebugdocument/@started").getText() + "");
                out.write("<td>");
                Attribute endedElement = (Attribute) debugDoc.selectSingleNode("/tmldebugdocument/@ended");
                if (endedElement != null) {
                    out.write(endedElement.getText());
                }
                else {
                    out.write("&nbsp;");
View Full Code Here

                if (index >= debugDocuments.size()) {
                    throw new HttpErrorException(HttpServletResponse.SC_BAD_REQUEST, "Index out of range: " + index + " where maximum index is " + (debugDocuments.size() - 1), null);
                }
                else {
                    Document doc = (Document) debugDocuments.get(index);
                    Element element = (Element) doc.selectSingleNode(request.getParameter("root"));
                    doc = DocumentFactory.getInstance().createDocument(element.createCopy());
                    doc.getRootElement().addAttribute("index", String.valueOf(index));

                    try {
                        DOMWriter domWriter = new DOMWriter();
View Full Code Here

     */
    public static String determineMinimumWGAVersion(InputStream in) {
        String version = "(unknown)";
        try {
            Document doc = (new SAXReader()).read(in);
            Element wgaVersionElement = (Element) doc.selectSingleNode("//minimumWGAVersion");
            version = wgaVersionElement.elementText("majorVersion") + "." + wgaVersionElement.elementText("minorVersion") + "." + wgaVersionElement.elementText("maintenanceVersion");
        }
        catch (Exception ee) {
        }
        return version;
View Full Code Here

        final InputStream is = servletURL.openStream();
        try {
            final Document document = new SAXReader().read(is);
            final String xpathBase = "/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                    + "/ActiveContextPolicies/ContextPolicy[@contextID='" + contextId + "']";
            final Node contextPolicyNode = document.selectSingleNode(xpathBase);
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug(contextPolicyNode.asXML());
            }
            return contextPolicyNode;
        } finally {
View Full Code Here

     */
    @Test
    @OperateOnDeployment("war")
    public void testWebPermissions(@ArquillianResource URL webAppURL) throws Exception {
        final Document doc = getPermissionDocument(webAppURL);
        testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='jacc-test.war']"));
        testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.war']"));
    }

View Full Code Here

    @OperateOnDeployment("war")
    public void testWebPermissions(@ArquillianResource URL webAppURL) throws Exception {
        final Document doc = getPermissionDocument(webAppURL);
        testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='jacc-test.war']"));
        testJACCWebPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.war']"));
    }

    /**
     * Tests EJB permissions (jar directly and jar in ear).
View Full Code Here

     */
    @Test
    @OperateOnDeployment("war")
    public void testEJBPermissions(@ArquillianResource URL webAppURL) throws Exception {
        final Document doc = getPermissionDocument(webAppURL);
        testJACCEjbPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='jar-jacc-test.jar']"));
        testJACCEjbPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.jar']"));
    }

View Full Code Here

    @OperateOnDeployment("war")
    public void testEJBPermissions(@ArquillianResource URL webAppURL) throws Exception {
        final Document doc = getPermissionDocument(webAppURL);
        testJACCEjbPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='jar-jacc-test.jar']"));
        testJACCEjbPermissions(doc.selectSingleNode("/" + ListJACCPoliciesServlet.ROOT_ELEMENT
                + "/ActiveContextPolicies/ContextPolicy[@contextID='ear-jacc-test.ear!ear-jacc-test.jar']"));
    }

    // Private methods -------------------------------------------------------
View Full Code Here

    }
    if (!hibernateConfigFile.isFile()) {
      throw new FileNotFoundException("Could not find hibernate.cfg.xml file");
    }
    Document hibCfg = new SAXReader().read(hibernateConfigFile);
    Node node = hibCfg.selectSingleNode("//property[@name = 'connection.url'");
    String url = "jdbc:hsqldb:" + hsqldbDir.getCanonicalFile().toURI() + "agila";
    node.setText(url);
    FileWriter w = new FileWriter(hibernateConfigFile);
    w.write(hibCfg.asXML());
    w.close();
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.