Examples of SAXReader


Examples of org.dom4j.io.SAXReader

  private Transitions parseXmlInput(File inputFile, Transitions transitions) throws SlideShowException{
    Transitions retVal = transitions;
    if(inputFile!=null){
      try{
        LOG.debug("Parsing xml transitions file "+inputFile.getAbsolutePath());   
        SAXReader reader = new SAXReader();
        Document document = reader.read(inputFile);
        Node rootNode = document.selectSingleNode("/transitions");
        if(rootNode != null){
          Node defType = rootNode.selectSingleNode("@defaulttype");
          Node defTransDur = rootNode.selectSingleNode("@defaulttduration");
          Node defDur = rootNode.selectSingleNode("@defaultduration");
View Full Code Here

Examples of org.dom4j.io.SAXReader

   * @return parsed document
   */
  public Document parse(InputStream in, boolean validateXML) {
    Document document;
    try {
      SAXReader reader = new SAXReader();
      reader.setEntityResolver(er);
      reader.setValidation(validateXML);
      document = reader.read(in, "");
    } catch (Exception e) {
      throw new OLATRuntimeException(XMLParser.class, "Exception reading XML", e);
    }
    return document;
  }
View Full Code Here

Examples of org.dom4j.io.SAXReader

      if (metaTmpFile == null)
         throw new IOException("Deployment plan does not contain an entry: " + DeploymentMetaData.ENTRY_NAME);

      try
      {
         SAXReader reader = new SAXReader();
         reader.setEntityResolver(new JBossEntityResolver());

         Document metaDoc = reader.read(metaTmpFile);
         metaData = new DeploymentMetaData(metaDoc);
         log.debug(DeploymentMetaData.ENTRY_NAME + "\n" + metaData.toXMLString());
      }
      catch (Exception e)
      {
View Full Code Here

Examples of org.dom4j.io.SAXReader

   * @throws DocumentException if the document could not be parsed
   */
  public static Document parseText(String text) throws DocumentException {
    Document result = null;

    SAXReader reader = new SAXReader();
    String encoding = getEncoding(text);

    InputSource source = new InputSource(new StringReader(text));
    source.setEncoding(encoding);

    result = reader.read(source);

    // if the XML parser doesn't provide a way to retrieve the encoding,
    // specify it manually
    if (result.getXMLEncoding() == null) {
      result.setXMLEncoding(encoding);
View Full Code Here

Examples of org.dom4j.io.SAXReader

            String msg = "Could not resolve the schema URI: "
                + inclSchemaInstanceURI;
            throw new InvalidSchemaException(msg);
          }

          SAXReader reader = new SAXReader();
          Document inclSchemaDocument = reader.read(inputSource);
          build(inclSchemaDocument);
        } catch (Exception e) {
          System.out.println("Failed to load schema: "
              + inclSchemaInstanceURI);
          System.out.println("Caught: " + e);
View Full Code Here

Examples of org.dom4j.io.SAXReader

        ZipEntry entry;
        Document tocDoc = null;
        while ((entry = zipIS.getNextEntry()) != null) {
            if (entry.getName().compareTo(Package.DefaultPackageFileName) == 0) {
                SAXReader reader = new SAXReader();
                tocDoc = reader.read(zipIS);
                break;
            }
        }

        if (tocDoc == null) {
View Full Code Here

Examples of org.dom4j.io.SAXReader

        // Lazy access to streams
        if (elements == null) {
            elements = new HashMap<String, Element>();
            for (FileDescriptor fileDescriptor : getResources()) {
                try {
                    SAXReader saxReader = new SAXReader();
                    saxReader.setMergeAdjacentText(true);

                    if (isSchemaValidating()) {
                        saxReader.setEntityResolver(new DTDEntityResolver());
                        saxReader.setValidation(true);
                        saxReader.setFeature("http://apache.org/xml/features/validation/schema",true);
                    }

                    elements.put(fileDescriptor.getName(), saxReader.read(fileDescriptor.getUrl().openStream()).getRootElement());

                } catch (DocumentException dex) {
                    Throwable nested = dex.getNestedException();
                    if (nested != null) {
                        if (nested instanceof FileNotFoundException) {
View Full Code Here

Examples of org.dom4j.io.SAXReader

        ZipEntry entry;
        Document tocDoc = null;
        while ((entry = zipIS.getNextEntry()) != null) {
            if (entry.getName().compareTo(Package.DefaultPackageFileName) == 0) {
                SAXReader reader = new SAXReader();
                tocDoc = reader.read(zipIS);
                break;
            }
        }

        if (tocDoc == null) {
View Full Code Here

Examples of org.dom4j.io.SAXReader

    }
  }

  private SAXReader getReader() {
    if (reader == null) {
      reader = new SAXReader();
    }

    return reader;
  }
View Full Code Here

Examples of org.dom4j.io.SAXReader

    File configurationFile = new File(WebappHelper.getContextRoot() + CONFIG_FILE);
   
    // this map contains the whole data
    Map<String, PortletInstitution> portletMap = new HashMap<String, PortletInstitution>();

    SAXReader reader = new SAXReader();
    try {
      Document doc = reader.read(configurationFile);
      Element rootElement = doc.getRootElement();
      List<Element> lstInst = rootElement.elements(ELEM_INSTITUTION);
      for( Element instElem : lstInst ) {
        String inst = instElem.attributeValue(ATTR_INSTITUTION_NAME);
        List<Element> lstTmpLinks = instElem.elements(ELEM_LINK);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.