Package cambridge.parser

Examples of cambridge.parser.TemplateTokenizer


   private Tokenizer tokenizer;

   @Before
   public void setUp() {
      try {
         tokenizer = new TemplateTokenizer(new BufferedReader(new InputStreamReader(TokenizerTest.class.getResourceAsStream("input.html"))));
      } catch (IOException e) {
         e.printStackTrace();
      }
   }
View Full Code Here


      }
   }

   public static void main(String[] args) {
      try {
         Tokenizer tokenizer = new TemplateTokenizer(TokenizerTest.class.getResourceAsStream("input.html"));

         Token token;
         while (tokenizer.hasMoreTokens()) {
            token = tokenizer.nextToken();
            System.out.println(token);
         }

         tokenizer.close();
      } catch (IOException e) {
         e.printStackTrace();
      }
   }
View Full Code Here

        return parseTemplate(in, DefaultEncoding, expressionLanguage);
    }

    public TemplateDocument parseTemplate(InputStream in, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException
    {
        TemplateTokenizer tokenizer = null;
        try
        {
            tokenizer = new TemplateTokenizer(new InputStreamReader(in, encoding));
            TemplateParser parser = new TemplateParser(tokenizer, this, expressionLanguage);
            return parser.parse();
        }
        catch (IOException e)
        {
            throw new TemplateLoadingException(e);
        }
        catch (TemplateParsingException e)
        {
            throw new TemplateLoadingException(e);
        }
        finally
        {
            if (tokenizer != null)
            {
                try
                {
                    tokenizer.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
View Full Code Here

        }
    }

    public TemplateDocument parseAndCreateTemplateDocument(String templateSource, ExpressionLanguage expressionLanguage) throws TemplateLoadingException
    {
        TemplateTokenizer tokenizer = null;
        try
        {
            tokenizer = new TemplateTokenizer(new StringReader(templateSource));
            TemplateParser parser = new TemplateParser(tokenizer, this, expressionLanguage);
            return parser.parse();
        }
        catch (IOException e)
        {
            throw new TemplateLoadingException(e);
        }
        catch (TemplateParsingException e)
        {
            throw new TemplateLoadingException(e);
        }
        finally
        {
            if (tokenizer != null)
            {
                try
                {
                    tokenizer.close();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
View Full Code Here

TOP

Related Classes of cambridge.parser.TemplateTokenizer

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.