Package org.dom4j.dom

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


   */
  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

            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

    @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

    @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

    @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

      response.setHeader("Cache-Control", "no-cache");

      HttpSession session = request.getSession();
      final FullTestResult testResult = (FullTestResult) session.getAttribute(TestConstants.ATTRIBUTE_TEST_RESULT);

      DOMDocument report = new DOMDocument();
      DOMElement testsuite = new DOMElement("testsuite");
      report.setRootElement(testsuite);

      if (testResult == null)
      {
         // No JUnit test results generated.
      }
View Full Code Here

      response.setHeader("Cache-Control", "no-cache");

      HttpSession session = request.getSession();
      final FullTestResult testResult = (FullTestResult) session.getAttribute(TestConstants.ATTRIBUTE_TEST_RESULT);

      DOMDocument report = new DOMDocument();
      DOMElement testsuite = new DOMElement("testsuite");
      report.setRootElement(testsuite);

      if (testResult == null)
      {
         // No JUnit test results generated.
      }
View Full Code Here

    // Test case(s)
    // -------------------------------------------------------------------------
    public void testBug1148333() {
        DOMDocumentFactory factory = (DOMDocumentFactory) DOMDocumentFactory
                .getInstance();
        DOMDocument doc = (DOMDocument) factory.createDocument();
        Element el = doc.addElement("root");
        el.addNamespace("pref2", "uri2");

        DOMDocument clone = (DOMDocument) doc.cloneNode(true);
       
        assertNotSame(doc, clone);
        assertNodesEqual(doc, clone);
    }
View Full Code Here

    @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

Related Classes of org.dom4j.dom.DOMDocument

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.