Package javax.xml.parsers

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


     *
     * @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

   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

    /**
     * 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

    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

  /**
   *
   */
  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

    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

     * 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

        /*
         * 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

    public List<BibtexEntry> importEntries(InputStream stream) throws IOException {

  ArrayList<BibtexEntry> bibItems = new ArrayList<BibtexEntry>();

  // 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


  try{
      SAXParser parser = parserFactory.newSAXParser(); //May throw exceptions
      BibTeXMLHandler handler = new BibTeXMLHandler();
      // Start the parser. It reads the file and calls methods of the handler.
      parser.parse(stream, handler);
      // When you're done, report the results stored by your handler object
      bibItems = handler.getItems();
View Full Code Here

TOP

Related Classes of javax.xml.parsers.SAXParserFactory

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.