Examples of SAXParserFactory


Examples of javax.xml.parsers.SAXParserFactory

  /**
   * Setup readers.
   */
  public void setupReaders() {
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
    spf.setValidating(false);

    SAXCatalogReader saxReader = new SAXCatalogReader(spf);

    saxReader.setCatalogParser(null, "XMLCatalog",
             "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

    }

    private void createParent() throws SAXException {
  XMLReader parent = null;
        try {
            SAXParserFactory pfactory = SAXParserFactory.newInstance();
            pfactory.setNamespaceAware(true);
           
            if (_transformer.isSecureProcessing()) {
                try {
                    pfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
                }
                catch (SAXException e) {}
            }
           
            SAXParser saxparser = pfactory.newSAXParser();
            parent = saxparser.getXMLReader();
        }
        catch (ParserConfigurationException e) {
            throw new SAXException(e);
        }
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

     *
     * @return  the object handler
     */
    private ObjectHandler getHandler() {
        if ( handler == null ) {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
                SAXParser parser = factory.newSAXParser();
                handler = new ObjectHandler( this, getClassLoader() );
                parser.parse( in, handler );
            }
            catch ( ParserConfigurationException e ) {
                getExceptionListener().exceptionThrown( e );
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

   elementBuffer = new StringBuffer();
  
   stopWords = StopFilter.makeStopSet(Constants.getSTOP_WORDS());
   questionWords = StopFilter.makeStopSet(Constants.getQwords());
  
   try { SAXParserFactory spf = SAXParserFactory.newInstance(); parser = spf.newSAXParser(); }
   catch (ParserConfigurationException pe)
   { logger.error("Cannot parse XML document Parse Config. Error" + pe.getMessage() ); }
   catch (SAXException se)
   { logger.error("Cannot parse XML document SAX Error: " + se.getMessage() ); }
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

    /**
     * Attaches the reader to the catalog.
     */
    private void attachReaderToCatalog (Catalog catalog) {

        SAXParserFactory spf = new SAXParserFactoryImpl();
        spf.setNamespaceAware(true);
        spf.setValidating(false);

        SAXCatalogReader saxReader = new SAXCatalogReader(spf);
        saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName, "catalog",
            "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
        catalog.addReader("application/xml", saxReader);
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

    public XMLPropertiesHandler() {
    }
   
    public static void parseFile(File file) throws ParserConfigurationException, SAXException, IOException {
        XMLPropertiesHandler handler;
        SAXParserFactory factory;
        SAXParser parser;
       
        handler = new XMLPropertiesHandler();
        factory = SAXParserFactory.newInstance();
        parser = factory.newSAXParser();
        parser.parse(file, handler);
    }
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

  /**
   *
   */
  private JRXmlDigester prepareDigester() throws ParserConfigurationException, SAXException
  {
    SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
   
    boolean validating = JRProperties.getBooleanProperty(JRProperties.EXPORT_XML_VALIDATION);   
    saxParserFactory.setValidating(validating);

    SAXParser saxParser = saxParserFactory.newSAXParser();
    //XMLReader xmlReader = XMLReaderFactory.createXMLReader();
    XMLReader xmlReader = saxParser.getXMLReader();

    xmlReader.setFeature("http://xml.org/sax/features/validation", validating);

View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

    throws Exception
    {
        InputSource is = new InputSource();
        is.setByteStream(in);
        is.setSystemId(url);
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(false);
        factory.setValidating(false);
        XMLReader reader = factory.newSAXParser().getXMLReader();
        reader.setEntityResolver(new LocalTaglibDtds());
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        reader.parse(is);
    }
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

     * objects.
     */
    public List<BibtexEntry> importEntries(InputStream stream) throws IOException {

        // Obtain a factory object for creating SAX parsers
        SAXParserFactory parserFactory = SAXParserFactory.newInstance();

        // Configure the factory object to specify attributes of the parsers it
        // creates
        parserFactory.setValidating(true);
        parserFactory.setNamespaceAware(true);

        // Now create a SAXParser object
        ArrayList<BibtexEntry> bibItems = null;
        try {
            SAXParser parser = parserFactory.newSAXParser(); // May throw
            // exceptions
            MedlineHandler handler = new MedlineHandler();
            // Start the parser. It reads the file and calls methods of the
            // handler.
            parser.parse(stream, handler);
View Full Code Here

Examples of javax.xml.parsers.SAXParserFactory

        /*
         * We have to look up the XMLReader using JAXP or SAX, as the SAXParser
         * supplied by Avalon/Excalibur does not seem to work with JING.
         */
        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            factory.setNamespaceAware(true);
            factory.setValidating(false);
            this.reader = factory.newSAXParser().getXMLReader();
            this.setEntityResolver(context);
            this.setErrorHandler(new DraconianErrorHandler());
            this.context = context;
        } catch (ParserConfigurationException exception) {
            throw new SAXException("Can't create XML reader instance", exception);
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.