Package org.xml.sax

Examples of org.xml.sax.Parser


     * @return a Resources array
     */
    public Resource[] readResources(Reader reader)
  throws IOException, SerializationException
    {
  Parser    parser    = getParser();
  XMLReader xmlreader = new XMLReader(reader, parser);
  return xmlreader.readResources();
    }
View Full Code Here


     * @return a Resources array
     */
    public AttributeHolder[] readAttributeHolders(Reader reader)
  throws IOException, SerializationException
    {
  Parser    parser    = getParser();
  XMLReader xmlreader = new XMLReader(reader, parser);
  return xmlreader.readAttributeHolders();
    }
View Full Code Here

     * @param attributes the attribute names array.
     */
    public LookupTable[] readAttributes(Reader reader, String attributes[])
      throws IOException, SerializationException
    {
  Parser parser = getParser();
  XMLSubsetReader xmlreader =
      new XMLSubsetReader(reader, parser, attributes);
  return xmlreader.readAttributeTables();
    }
View Full Code Here

    InputSource source = new InputSource(docURL.openStream());
    source.setSystemId(docURL.toString());
                SAXParserFactory spf = SAXParserFactory.newInstance();
                spf.setValidating(false);
                SAXParser saxParser = spf.newSAXParser();
                Parser sourceParser = saxParser.getParser();
    XMLProcessorEx sourceLoader = new XMLProcessorImpl(sourceParser);
    //  long start = System.currentTimeMillis();
    Node root =
      sourceLoader.load(
        source,
View Full Code Here

        if (bResolver != null) {
          spHandler.setEntityResolver(bResolver);
        }
        parser.parse(new InputSource(is), spHandler);
      } else {
        Parser parser = (Parser) Class.forName(parserClass).newInstance();
        parser.setDocumentHandler(this);
        if (bResolver != null) {
          parser.setEntityResolver(bResolver);
        }
        parser.parse(new InputSource(is));
      }
    } catch (ClassNotFoundException cnfe) {
      throw new CatalogException(CatalogException.UNPARSEABLE);
    } catch (IllegalAccessException iae) {
      throw new CatalogException(CatalogException.UNPARSEABLE);
View Full Code Here

        throws SAXException, IOException {
        if (is == null) {
            throw new IllegalArgumentException("InputSource cannot be null");
        }

        Parser parser = this.getParser();
        if (hb != null) {
            parser.setDocumentHandler(hb);
            parser.setEntityResolver(hb);
            parser.setErrorHandler(hb);
            parser.setDTDHandler(hb);
        }
        parser.parse(is);
    }
View Full Code Here

     * @exception Exception if any processing exception occurs
     */
    public void parse(URL url) throws Exception {

        // Construct a parser for our use
        Parser parser =
            ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");
        parser.setDocumentHandler(this);
        parser.setErrorHandler(this);

        // Perform the requested parse
        long before = System.currentTimeMillis();
        parser.parse(url.toString());
        long after = System.currentTimeMillis();

        // Log the results
        StaticLogger.write("Parsing time = " + (after - before) +
                           " milliseconds");
View Full Code Here

         *
         * @see org.exolab.castor.builder.SourceGenerator
         *      #generateSource(org.xml.sax.InputSource, java.lang.String)
         */
        public void generateSource(final InputSource source, final String packageName) {
            Parser parser = null;
            try {
                parser = LocalConfiguration.getInstance().getParser();
            } catch (RuntimeException e) {
                throw new BuildException("Unable to create SAX parser.", e);
            }
            if (parser == null) {
                throw new BuildException("Unable to create SAX parser.");
            }

            SchemaUnmarshaller schemaUnmarshaller = null;
            try {
                schemaUnmarshaller = new SchemaUnmarshaller();
            } catch (XMLException e) {
                throw new BuildException("Unable to create schema unmarshaller.", e);
            }

            Sax2ComponentReader handler = new Sax2ComponentReader(schemaUnmarshaller);
            parser.setDocumentHandler(handler);
            parser.setErrorHandler(handler);
            try {
                parser.parse(source);
            } catch (IOException e) {
                String msg = "Can't read input file " + source.getSystemId() + ".\n" + e;
                throw new BuildException(msg, e);
            } catch (SAXException e) {
                String msg = "Can't parse input file " + source.getSystemId() + ".\n" + e;
View Full Code Here

     * @exception Exception if any processing exception occurs
     */
    public void parse(URL url) throws Exception {

        // Construct a parser for our use
        Parser parser =
            ParserFactory.makeParser("org.apache.xerces.parsers.SAXParser");
        parser.setDocumentHandler(this);
        parser.setErrorHandler(this);

        // Perform the requested parse
        long before = System.currentTimeMillis();
        parser.parse(url.toString());
        long after = System.currentTimeMillis();

        // Log the results
        StaticLogger.write("Parsing time = " + (after - before) +
                           " milliseconds");
View Full Code Here

                    try {
                        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;
View Full Code Here

TOP

Related Classes of org.xml.sax.Parser

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.