Package org.olat.core.util.xml

Examples of org.olat.core.util.xml.XMLParser


    BufferedInputStream bis = null;
    Document doc = null;
    try {
      in = new FileInputStream(documentF);
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
    }
    catch (IOException e) {
      throw new OLATRuntimeException(ScormCPManifestTreeModel.class, "could not read and parse from file "+documentF.getAbsolutePath(),e);
    }
    finally {
View Full Code Here


    BufferedInputStream bis = null;
    Document doc = null;
    try {
      in = documentF.getInputStream();
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
    catch (Exception e) { return null; }
    finally {
      try {
        if (in != nullin.close();
        if (bis != null) bis.close();
View Full Code Here

    BufferedInputStream bis = null;
    Document doc = null;
    try {
      in = new FileInputStream(documentF);
      bis = new BufferedInputStream(in);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
    catch (Exception e) { return null; }
    finally {
      try {
        if (in != nullin.close();
        if (bis != null) bis.close();
View Full Code Here

  private Document loadDocument(VFSLeaf documentF) {
    InputStream in = null;
    Document doc = null;
    try {
      in = documentF.getInputStream();
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(in, false);
      in.close();
    }
    catch (IOException e) {
      throw new OLATRuntimeException(CPManifestTreeModel.class, "could not read and parse from file " + documentF, e);
    }
View Full Code Here

    } catch (FileNotFoundException e) { 
      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;
View Full Code Here

    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());
      doc = xmlParser.parse(bis, true);
    } catch (Exception e) {     
      log.warn("Exception when parsing input QTI input stream for " + fIn != null ? fIn.getAbsolutePath() : "qti.xml", e);
      return null;
    } finally {
      try {
View Full Code Here

    File fDoc = new File(fUserdataRoot, path);
    Document doc = null;
    try {
      InputStream is = new FileInputStream(fDoc);
      BufferedInputStream bis = new BufferedInputStream(is);
      XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
      doc = xmlParser.parse(bis, false);
      is.close();
      bis.close();
    } catch (Exception e) {
      throw new OLATRuntimeException(FilePersister.class, "Error retrieving results reporting for subject: '" + subj.getName() + "'; assessment id: '" + aiid + "'", e);
    }
View Full Code Here

  /**
   *
   * @see org.olat.ims.cp.CPManager#load(org.olat.core.util.vfs.VFSContainer)
   */
  public ContentPackage load(VFSContainer directory, OLATResourceable ores) {
    XMLParser parser = new XMLParser();
    ContentPackage cp;

    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

  public String getAuthorFromXmlMetaData(File fMeta) {
    if (fMeta == null) return null;
    FileInputStream in;
    try in = new FileInputStream(fMeta); }
    catch (FileNotFoundException e) {  return null}
    XMLParser xmlp = new XMLParser();
    Document doc = xmlp.parse(in, false);
    if (doc == null) return null;
   
    // extract data from XML
    Element root = doc.getRootElement();
    Element authorElement = root.element("author");
View Full Code Here

   *
   * @param is
   * @return
   */
  private static Document getDocument(InputStream is) {
    XMLParser xmlParser = new XMLParser(new IMSEntityResolver());
    Document doc = null;
    try {
      doc = xmlParser.parse(is, false);
      is.close();
    } catch (Exception e) {
      // nothing we can do - could be IOException or org.dom4j.DocumentException     
      doc = null;
    } finally {
View Full Code Here

TOP

Related Classes of org.olat.core.util.xml.XMLParser

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.