Package org.xml.sax.helpers

Examples of org.xml.sax.helpers.ParserAdapter


        // read in XML file and parse to content handler
   
        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser parser = factory.newSAXParser();
        ParserAdapter adapter = new ParserAdapter(parser.getParser());
        adapter.setContentHandler(documentFilter);
        adapter.parse(requestSource);
       
        assertEquals(contentHandler.filters.size(),1);
  }
View Full Code Here


//        consoleHandler.setLevel(Level.ALL);
//    logger.addHandler(consoleHandler);
        // read in XML file and parse to content handler
        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser parser = factory.newSAXParser();
        ParserAdapter adapter = new ParserAdapter(parser.getParser());
        adapter.setContentHandler(documentFilter);
        adapter.parse(requestSource);
       
//        assertEquals(contentHandler.filters.size(),1);
  }
View Full Code Here

        logger.addHandler(consoleHandler);
       
        // read in XML file and parse to content handler
        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser parser = factory.newSAXParser();
        ParserAdapter adapter = new ParserAdapter(parser.getParser());
        adapter.setContentHandler(documentFilter);
        adapter.parse(requestSource);
       
        assertEquals(1, contentHandler.filters.size());
        Filter f = (Filter)contentHandler.filters.get(0);
        assertTrue(f instanceof BinaryLogicOperator);
        assertEquals(FilterType.LOGIC_OR, Filters.getFilterType(f));
View Full Code Here

        //parser.setContentHandler(documentFilter);
        //parser.parse(uri);
        SAXParserFactory fac = SAXParserFactory.newInstance();
        SAXParser parser = fac.newSAXParser();

        ParserAdapter p = new ParserAdapter(parser.getParser());
        p.setContentHandler(documentFilter);
        LOGGER.fine("just made parser, " + uri);
        p.parse(TestData.getResource(this, uri).toExternalForm());
        LOGGER.finest("just parsed: " + uri);

        return filterHandler.getFilter();
    }
View Full Code Here

                Project.MSG_VERBOSE);
        } else {

            // see if it is a SAX1 Parser
            if (reader instanceof Parser) {
                xmlReader = new ParserAdapter((Parser) reader);
                log("Using SAX1 parser " + reader.getClass().getName(),
                    Project.MSG_VERBOSE);
            else {
                throw new BuildException(INIT_FAILED_MSG
                    + reader.getClass().getName()
View Full Code Here

        // read in XML file and parse to content handler
        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser parser = factory.newSAXParser();
            ParserAdapter adapter = new ParserAdapter(parser.getParser());

            adapter.setContentHandler(documentFilter);
            adapter.parse(requestSource);
            LOGGER.fine("just parsed: " + requestSource);
        } catch (SAXException e) {
            //SAXException does not sets initCause(). Instead, it holds its own "exception" field.
            if(e.getException() != null && e.getCause() == null){
                e.initCause(e.getException());
View Full Code Here

    public void startElement (String name, AttributeList atts)
  throws SAXException
    {
      if (m_documentHandler == null)      
      {
        m_documentHandler = new ParserAdapter(new org.apache.xerces.parsers.SAXParser());
        if (m_transformerImpl != null)
        { 
          ((ParserAdapter)m_documentHandler).setContentHandler(m_transformerImpl.getInputContentHandler());
        }
        /* else if (m_transformerImpl != null)
View Full Code Here

    public void endElement (String name)
  throws SAXException
    {
      if (m_documentHandler == null)       
      {        
        m_documentHandler = new ParserAdapter(new org.apache.xerces.parsers.SAXParser());
        if (m_transformerImpl != null)
        {
          ((ParserAdapter)m_documentHandler).setContentHandler(m_transformerImpl.getInputContentHandler());
        }
     /* else if (m_transformerImpl != null)
View Full Code Here

                        parser = XMLReaderFactory.createXMLReader(parserName);
                    }
                    catch (Exception e) {
                        try {
                            Parser sax1Parser = ParserFactory.makeParser(parserName);
                            parser = new ParserAdapter(sax1Parser);
                            System.err.println("warning: Features and properties not supported on SAX1 parsers.");
                        }
                        catch (Exception ex) {
                            parser = null;
                            System.err.println("error: Unable to instantiate parser ("+DEFAULT_PARSER_NAME+")");
View Full Code Here

                        parser = XMLReaderFactory.createXMLReader(parserName);
                    }
                    catch (Exception e) {
                        try {
                            Parser sax1Parser = ParserFactory.makeParser(parserName);
                            parser = new ParserAdapter(sax1Parser);
                            System.err.println("warning: Features and properties not supported on SAX1 parsers.");
                        }
                        catch (Exception ex) {
                            parser = null;
                            System.err.println("error: Unable to instantiate parser ("+parserName+")");
View Full Code Here

TOP

Related Classes of org.xml.sax.helpers.ParserAdapter

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.