Package org.dom4j.tree

Examples of org.dom4j.tree.DefaultDocument


    VFSLeaf file = (VFSLeaf) directory.resolve("imsmanifest.xml");

    if (file != null) {
      try {
        DefaultDocument doc = (DefaultDocument) parser.parse(file.getInputStream(), false);
        cp = new ContentPackage(doc, directory, ores);
        // If a wiki is imported or a new cp created, set a unique orga
        // identifier.
        if (cp.getLastError() == null) {
          if (cp.isOLATContentPackage() && CPCore.OLAT_ORGANIZATION_IDENTIFIER.equals(cp.getFirstOrganizationInManifest().getIdentifier())) {
View Full Code Here


   *
   * @return the xml Document of this CP
   */
  public DefaultDocument buildDocument() {
    // if (doc != null) return doc;
    DefaultDocument newDoc = new DefaultDocument();
    rootNode.buildDocument(newDoc);
    return newDoc;
  }
View Full Code Here

      outFile = (VFSLeaf) cpcore.getRootDir().resolve("/" + filename);
      if (outFile == null) {
        // if not, create it
        outFile = cpcore.getRootDir().createChildLeaf("/" + filename);
      }
      DefaultDocument manifestDocument = cpcore.buildDocument();
      XMLWriter writer = new XMLWriter(outFile.getOutputStream(false), format);
      writer.write(manifestDocument);
    } catch (Exception e) {
      log.error("imsmanifest for ores " + ores.getResourceableId() + "couldn't be written to file.", e);
      throw new OLATRuntimeException(CPOrganizations.class, "Error writing imsmanifest-file", new IOException());
View Full Code Here

        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

        log("Wrote to encoding: " + encoding);
    }

    public void testWriterBug() throws Exception {
        Element project = new BaseElement("project");
        Document doc = new DefaultDocument(project);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLWriter writer = new XMLWriter(out, new OutputFormat("\t", true,
                "ISO-8859-1"));
        writer.write(doc);
View Full Code Here

        return (DocumentFactory) singleton.instance();
    }

    // Factory methods
    public Document createDocument() {
        DefaultDocument answer = new DefaultDocument();
        answer.setDocumentFactory(this);

        return answer;
    }
View Full Code Here

        Namespace ns1 = Namespace.get("p1", "www.acme1.org");
        Namespace ns2 = Namespace.get("p2", "www.acme2.org");
        Element element = new DefaultElement("test", ns1);
        Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
        element.add(attribute);
        Document doc = new DefaultDocument(element);
       
        XPath xpath = new Dom4jXPath( "//namespace::node()" );
        List results = xpath.selectNodes( doc );
        assertEquals( 3, results.size() );
View Full Code Here

            Element element = new DefaultElement("test", ns1);
            Attribute attribute = new DefaultAttribute("pre:foo", "bar", ns2);
            element.add(attribute);
            Element root = new DefaultElement("root", ns0);
            root.add(element);
            Document doc = new DefaultDocument(root);
           
            XPath xpath = new Dom4jXPath( "/*/*/namespace::node()" );

            List results = xpath.selectNodes( doc );

View Full Code Here

/*  97 */     return (DocumentFactory)singleton.instance();
/*     */   }
/*     */
/*     */   public Document createDocument()
/*     */   {
/* 102 */     DefaultDocument answer = new DefaultDocument();
/* 103 */     answer.setDocumentFactory(this);
/*     */
/* 105 */     return answer;
/*     */   }
View Full Code Here

TOP

Related Classes of org.dom4j.tree.DefaultDocument

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.