Package org.dom4j

Examples of org.dom4j.Document


    super(factory);
  }
 
  @Override
  public String createXML() {
    Document doc = DocumentHelper.createDocument();
    Element root = doc.addElement("dependencies");
    List<PageDependencyEntity> list = getDao().getPageDependencyDao().select();
    for (PageDependencyEntity entity : list) {
      Element itemElement = root.addElement("item");
      itemElement.addElement("page").setText(entity.getPage());
      itemElement.addElement("dependency").setText(entity.getDependency());
    }
    return doc.asXML();
  }
View Full Code Here


   * @throws DocumentException
   * @throws DaoTaskException
   */
  public void readFile(String xml) throws DocumentException,
      DaoTaskException {
    Document doc = DocumentHelper.parseText(xml);
    read(doc.getRootElement());
  }
View Full Code Here

    return roots;
  }
 
  @Override
  public String createXML() {
    Document doc = DocumentHelper.createDocument();
    Element element = doc.addElement("tags");
    List<TreeItemDecorator<TagEntity>> list = getTagTreeRoots();
    for (TreeItemDecorator<TagEntity> tag : list) {
      createTagXML(element, tag);
    }
    return doc.asXML();
  }
View Full Code Here

   * @throws DocumentException
   * @throws DaoTaskException
   */
  public void read(String xml) throws DocumentException,
      DaoTaskException {
    Document doc = DocumentHelper.parseText(xml);
    readTags(doc.getRootElement(), null);
  }
View Full Code Here

    }
  }
 
  public void readSiteContent(final ZipEntry entry, final String xml)
      throws DocumentException, DaoTaskException {
    Document doc = DocumentHelper.parseText(xml);
    Element root = doc.getRootElement();
    for (Iterator<Element> i = root.elementIterator(); i.hasNext();) {
      Element element = i.next();
      if (element.getName().equals("config")) {
        getConfigExporter().readConfigs(element);
      }
View Full Code Here

    if (vfsQTI==null){
      throw new AssertException("qti file did not exist even it should be guaranteed by repositor check-in "
          + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    //ensures that InputStream is closed in every case.
    Document doc = QTIHelper.getDocument((LocalFileImpl)vfsQTI);
    if(doc == null){
      //error reading qti file (existence check was made before)
      throw new AssertException("qti file could not be read " + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    // Extract min, max and cut value
    Float minValue = null, maxValue = null, cutValue = null;
    Element decvar = (Element) doc.selectSingleNode("questestinterop/assessment/outcomes_processing/outcomes/decvar");
    if (decvar != null) {
      Attribute minval = decvar.attribute("minvalue");
      if (minval != null) {
        String mv = minval.getValue();
        try {
View Full Code Here

  /**
   * Get the structure as an XML Document.
   * @return XML Document.
   */
  public Document getDocument() {
    Document tmp = DocumentHelper.createDocument();
    DocumentType type = new DOMDocumentType();
    type.setElementName(DOCUMENT_ROOT);
    type.setSystemID(DOCUMENT_DTD);
   
    tmp.setDocType(type);
    Element questestinterop = tmp.addElement(DOCUMENT_ROOT);
    this.assessment.addToElement(questestinterop);
    return tmp;
  }
View Full Code Here

      return false
    }
   
    try {
      XMLParser xmlp = new XMLParser();
      Document doc = xmlp.parse(is, false);
      if (doc == null) return false;
     
      // extract data from XML
      Element root = doc.getRootElement();
      Element n;
      n = root.element("author");
      if (n == null) {
        authorIdentKey = null;
      } else {
View Full Code Here

      if (hasSerializedQTIDocument()) {
        qtiDocument = loadSerializedQTIDocument();
        resumed = true;
      } else {
        unzipPackage();
        Document doc = loadQTIDocument();
        if(doc!=null) {
          ParserManager parser = new ParserManager();
          qtiDocument = (QTIDocument)parser.parse(doc);
          // grab assessment type
          Metadata meta = qtiDocument.getAssessment().getMetadata();
View Full Code Here

   */
  private Document loadQTIDocument() {
    File fIn = null;
    FileInputStream in = null;
    BufferedInputStream bis = null;
    Document doc = null;
    try {
      fIn = new File(packageDir, ImsRepositoryResolver.QTI_FILE);
      in = new FileInputStream(fIn);
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
View Full Code Here

TOP

Related Classes of org.dom4j.Document

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.