Package org.dom4j.io

Examples of org.dom4j.io.XMLWriter


    return xmlWriter;
  }

  private XMLWriter createXMLWriter() throws IOException {
    if (this.xmlWriter == null) {
      xmlWriter = new XMLWriter(outputFormat);
    }

    return xmlWriter;
  }
View Full Code Here


    File fOut = null;
    OutputStream out = null;
    try {
      fOut = new File(packageDir, ImsRepositoryResolver.QTI_FILE);
      out = new FileOutputStream(fOut);
      XMLWriter writer = new XMLWriter(out, outformat);
      writer.write(doc);
      writer.close();
    } catch (Exception e) {
      throw new OLATRuntimeException(this.getClass(), "Exception when saving QTI document to " + fOut != null ? fOut.getAbsolutePath() : "qti.xml", e);
    } finally {
      if (out != null) try {
        out.close();
View Full Code Here

    File fReportingDir = new File(fUserdataRoot, path);
    try {
      fReportingDir.mkdirs();
      OutputStream os = new FileOutputStream(new File(fReportingDir, aiid + ".xml"));
      Element element = doc.getRootElement();
      XMLWriter xw = new XMLWriter(os, new OutputFormat("  ", true));
      xw.write(element);
      //closing steams
      xw.close();
      os.close();
    } catch (Exception e) {
      throw new OLATRuntimeException(FilePersister.class, "Error persisting results reporting for subject: '" + subj.getName() + "'; assessment id: '" + aiid + "'", e);
    }
  }
View Full Code Here

      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

    ConfigurationConfig cc = new ConfigurationConfig();
    cc.setId(el.attributeValue("id"));
    cc.setCondition(el.attributeValue("condition"));
    cc.setReplace(Boolean.parseBoolean(el.attributeValue("replace")));
    StringWriter w = new StringWriter();
    XMLWriter x = new XMLWriter(w);
    try {
      x.write(el);
    } catch (IOException e) {
    }
    XMLConfiguration xmlConfig = new XMLConfiguration();
    try {
      xmlConfig.load(new StringReader(w.toString()));
View Full Code Here

 
  public void serializetoXML(OutputStream out, String aEncodingScheme, Document doc)
      throws Exception {
    OutputFormat outformat = OutputFormat.createPrettyPrint();
    outformat.setEncoding(aEncodingScheme);
    XMLWriter writer = new XMLWriter(out, outformat);
    writer.write(doc);
    writer.flush();
  }
View Full Code Here

        // httpServletResponse.setHeader("Content-Length", ""+
        // rf.length());

        OutputFormat outformat = OutputFormat.createPrettyPrint();
        outformat.setEncoding("UTF-8");
        XMLWriter writer = new XMLWriter(out, outformat);
        writer.write(document);
        writer.flush();
       
        out.flush();
        out.close();
       
      }
View Full Code Here

        }
     
      OutputFormat outformat = OutputFormat.createPrettyPrint();
      outformat.setXHTML(true);
      outformat.setEncoding("UTF-8");
      XMLWriter writer = new XMLWriter(System.out, outformat);
      writer.write(document);
      writer.flush();
      writer.close();
     
     
   
    } catch (Exception err) {
      err.printStackTrace();
View Full Code Here

 
  public void serializetoXML(OutputStream out, String aEncodingScheme, Document doc)
      throws Exception {
    OutputFormat outformat = OutputFormat.createPrettyPrint();
    outformat.setEncoding(aEncodingScheme);
    XMLWriter writer = new XMLWriter(out, outformat);
    writer.write(doc);
    writer.flush();
  }
View Full Code Here

  public void serializetoXML(OutputStream out, String aEncodingScheme, Document doc)
      throws Exception {
    OutputFormat outformat = OutputFormat.createPrettyPrint();
    outformat.setXHTML(true);
    outformat.setEncoding(aEncodingScheme);
    XMLWriter writer = new XMLWriter(out, outformat);
    writer.write(doc);
    writer.flush();
    writer.close();
    out.close();
  }
View Full Code Here

TOP

Related Classes of org.dom4j.io.XMLWriter

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.