Package net.sourceforge.chaperon.parser.output

Examples of net.sourceforge.chaperon.parser.output.EventQueue


      {
        extractLevel--;

        try
        {
          EventQueue queue = parser.parse(parsertable, new ByteArrayInputStream(text.toString().getBytes()));

          SAXEventAdapter adapter = new SAXEventAdapter(handler, ignorabletokens, true);
          queue.fireEvents(adapter);
        }
        catch (ParserException pe)
        {
          pe.printStackTrace();
        }
View Full Code Here


    //System.out.println("generate");
    TextParser parser = null;
    try
    {
      parser = (TextParser) this.manager.lookup("net.sourceforge.chaperon.cocoon.TextParser");
      EventQueue queue = parser.parse(_parsertable, _inputSource.getInputStream());

      SAXEventAdapter adapter = new SAXEventAdapter(super.contentHandler, _includeIgnorableTokens, false);
      queue.fireEvents(adapter);
    } catch (ParserException pe)
    {
      getLogger().error("Could not parse source", pe);
      throw new ProcessingException("Could not parse source", pe);
    } catch (SourceException se)
View Full Code Here

 
      TextParser parser = null;
      try
      {
        parser = (TextParser) _manager.lookup("net.sourceforge.chaperon.cocoon.TextParser");
        EventQueue queue = parser.parse(_parsertable, new ByteArrayInputStream(_text.toString().getBytes()));

        SAXEventAdapter adapter = new SAXEventAdapter(super.contentHandler, _includeIgnorableTokens, true);
        //adapter.enableLogging(getLogger());
        queue.fireEvents(adapter);
      }
      catch (ComponentException ce)
      {
        getLogger().error("Could not lookup for component", ce);
        throw new SAXException("Could not lookup for component", ce);
View Full Code Here

        ensureDirectoryFor(outFile);
        log("Parsing files from " + destDir);

        ObjectInputStream in = new ObjectInputStream(new FileInputStream(parsertableFile));

        EventQueue queue = parser.parse((ParserTable)in.readObject(), new FileInputStream(inFile), encoding);
        in.close();

        OutputFormat format = new OutputFormat(Method.XML, "ASCII", indent); // Serialize DOM

        if (indent)
        {
          format.setIndenting(true);
          format.setIndent(1);
        }
        else
          format.setPreserveSpace(true);

        StringWriter stringOut = new StringWriter(); // Writer will be a String
        XMLSerializer serial = new XMLSerializer(stringOut, format);

        SAXEventAdapter adapter = new SAXEventAdapter(serial.asContentHandler(), ignorableTokens, false);
        adapter.enableLogging(new AntLogger(this, msgLevel));
        queue.fireEvents(adapter);

        FileOutputStream outputstream = new FileOutputStream(outFile);
        PrintWriter printstream = new PrintWriter(outputstream);

        printstream.println(stringOut.toString());
View Full Code Here

        ensureDirectoryFor(outFile);
        log("Parsing file " + inFile + " to " + outFile, Project.MSG_INFO);

        ObjectInputStream in = new ObjectInputStream(new FileInputStream(parsertableFile));
       
        EventQueue queue = parser.parse((ParserTable)in.readObject(), new FileInputStream(inFile), encoding);
        in.close();

        OutputFormat format = new OutputFormat(Method.XML, "ASCII", indent); // Serialize DOM

        if (indent)
        {
          format.setIndenting(true);
          format.setIndent(1);
        }
        else
          format.setPreserveSpace(true);

        StringWriter stringOut = new StringWriter(); // Writer will be a String
        XMLSerializer serial = new XMLSerializer(stringOut, format);

        SAXEventAdapter adapter = new SAXEventAdapter(serial.asContentHandler(), ignorableTokens, false);
        adapter.enableLogging(new AntLogger(this, msgLevel));
        queue.fireEvents(adapter);

        FileOutputStream outputstream = new FileOutputStream(outFile);
        PrintWriter printstream = new PrintWriter(outputstream);

        printstream.println(stringOut.toString());
View Full Code Here

   */
  public CmdLineParser(File grammarFile, File inputFile,
                       OutputStream os) throws Exception
  {
    final ParserTable pt = parseGrammar(grammarFile);
    final EventQueue queue = parseInput(pt, inputFile);

    dumpDocument(queue, os);
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.chaperon.parser.output.EventQueue

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.