Package org.jdom.input

Examples of org.jdom.input.SAXBuilder


   *          the org.apache.xerces.parsers.SAXParser.
   * @param boolean validate
   * @return org.jdom.input.SAXBuilder
   */
  public static SAXBuilder createSAXBuilder(boolean validate) {
    return new SAXBuilder(getParserClassName(), validate);
  }
View Full Code Here


   * Returns a SAXBuilder
   * @param boolean validate
   * @return org.jdom.input.SAXBuilder
   */
  public static SAXBuilder createSAXBuilder(String saxDriverClass, boolean validate) {
    return new SAXBuilder(saxDriverClass, validate);
  }
View Full Code Here

       
        if(filename.length() == 0){
            ArgCheck.isNotZeroLength(filename,CorePlugin.Util.getString("JdomHelper.The_file_name_may_not_be_zero-length_4")); //$NON-NLS-1$
        }
       
        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder( saxDriverClass, validateXML );
        return builder.build( new File( filename ) );
    }
View Full Code Here

     * @param the document instance
     * @throws IOException if the file does not exist.
     * @throws JDOMException when errors occur in parsing.
     */
    public static Document buildDocument( String saxDriverClass, File file, boolean validateXML) throws IOException, JDOMException {
        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder( saxDriverClass, validateXML );
        return builder.build(file);
    }
View Full Code Here

    public static Document buildDocument( String saxDriverClass, InputStream stream, boolean validateXML) throws IOException, JDOMException {
        if(stream == null){
            ArgCheck.isNotNull(stream,CorePlugin.Util.getString("JdomHelper.The_InputStream_may_not_be_null_7")); //$NON-NLS-1$
        }
       
        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder( saxDriverClass, validateXML );
        return builder.build( stream );
    }
View Full Code Here

    public static Document buildDocument( String saxDriverClass, java.io.Reader stream, boolean validateXML) throws IOException, JDOMException {
        if(stream == null){
            ArgCheck.isNotNull(stream,CorePlugin.Util.getString("JdomHelper.The_InputStream_may_not_be_null_10")); //$NON-NLS-1$
        }
       
        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder( saxDriverClass, validateXML );
        return builder.build( stream );
    }
View Full Code Here

     */
    public List parseXMLQueryFile(String queryScenarioID, File queryFile, String querySetID) throws IOException, JDOMException {

  List<QueryTest> queries = new LinkedList();
//        HashMap queryMap = new HashMap();
        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder(false);
        Document queryDocument = builder.build(queryFile);
        List queryElements = queryDocument.getRootElement().getChildren(TagNames.Elements.QUERY);
        Iterator iter = queryElements.iterator();
        while ( iter.hasNext() ) {
            Element queryElement = (Element) iter.next();
            String queryName = queryElement.getAttributeValue(TagNames.Attributes.NAME);
View Full Code Here

    public ResultsHolder parseXMLResultsFile(final File resultsFile) throws IOException, JDOMException {

        QueryResults queryResults;
        ResultsHolder expectedResults = null;

        final SAXBuilder builder = SAXBuilderHelper.createSAXBuilder(false);
        final Document resultsDocument = builder.build(resultsFile);
        final String query = resultsDocument.getRootElement().getChildText(TagNames.Elements.QUERY);
        final List resultElements = resultsDocument.getRootElement().getChildren(TagNames.Elements.QUERY_RESULTS);
        final Iterator iter = resultElements.iterator();
        while ( iter.hasNext() ) {
            final Element resultElement = (Element) iter.next();
View Full Code Here

     * @return the modified parent
     * @exception JDOMException if there is an error consuming the message.
     */
    public Element parseXMLResultsFile(File resultsFile, Element parent) throws IOException, JDOMException {

        SAXBuilder builder = SAXBuilderHelper.createSAXBuilder(false);
        Document resultsDocument = builder.build(resultsFile);
        List resultElements = resultsDocument.getRootElement().getChildren(TagNames.Elements.QUERY_RESULTS);
        Iterator iter = resultElements.iterator();
        while ( iter.hasNext() ) {
            Element resultElement = (Element) iter.next();
            if ( resultElement.getChild(TagNames.Elements.SELECT) == null ) {
View Full Code Here

      logger.debug("XmlDocumentReader: Null Document name passed in, can't initialize.");
      return null;
    }
    Document doc = null;
    try {
      SAXBuilder builder = new SAXBuilder(false);
      if (validate == false) {
        logger.debug("Setting the EntityResolver to IgnoreDTDResolver.");
        builder.setEntityResolver(new IgnoreDTDResolver());
      }
      else {
        logger.debug("Using the default EntityResolver.");
      }
      if (fileName.toLowerCase().indexOf("http") == 0 || fileName.toLowerCase().indexOf("file") == 0) {
        // build from url
        logger.debug("Building document from " + fileName);
        java.net.URL url = null;
        try {
          url = new java.net.URL(fileName);
        }
        catch (Exception e) {
          logger.fatal(e.getMessage(), e);
          throw new XmlDocumentReaderException(e.getMessage(), e);
        }
//        logger.info("Started - SAXBuilder.build for URL " + fileName);
        doc = builder.build(url);
//        logger.info("Ended - SAXBuilder.build for URL " + fileName);
      }
      else {
        // build from file
//        logger.info("Started - SAXBuilder.build for file " + fileName);
        doc = builder.build(new File(fileName));
//        logger.info("Ended - SAXBuilder.build for file " + fileName);
      }
      logger.debug("XmlDocumentReader:" + fileName + ":successfully read!");
      if (validate) {
        XmlValidator xmlValidator = new XmlValidator();
View Full Code Here

TOP

Related Classes of org.jdom.input.SAXBuilder

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.