Package com.opensymphony.module.sitemesh.html.tokenizer

Examples of com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer


    public void addRule(TagRule rule) {
        defaultState.addRule(rule);
    }

    public void process() throws IOException {
        TagTokenizer tokenizer = new TagTokenizer(sitemeshBuffer.getCharArray(), sitemeshBuffer.getBufferLength());
        final HTMLProcessorContext context = new HTMLProcessorContext() {

            public SitemeshBuffer getSitemeshBuffer() {
                return sitemeshBuffer;
            }

            public State currentState() {
                return currentState;
            }

            public void changeState(State newState) {
                currentState = newState;
            }

            private SitemeshBufferFragment.Builder[] buffers = new SitemeshBufferFragment.Builder[10];
            private int size;

            public void pushBuffer(SitemeshBufferFragment.Builder buffer) {
                if(size == buffers.length) {
                  SitemeshBufferFragment.Builder[] newBuffers = new SitemeshBufferFragment.Builder[buffers.length * 2];
                  System.arraycopy(buffers, 0, newBuffers, 0, buffers.length);
                  buffers = newBuffers;
                }
                buffers[size++] = buffer;
            }
 
            public SitemeshBufferFragment.Builder currentBuffer() {
                return buffers[size - 1];
            }
 
            public SitemeshBufferFragment.Builder popBuffer() {
                SitemeshBufferFragment.Builder last = buffers[size - 1];
                buffers[--size] = null;
                return last;
            }
        };
        context.pushBuffer(body);
        tokenizer.start(new TokenHandler() {

            public boolean shouldProcessTag(String name) {
                return currentState.shouldProcessTag(name.toLowerCase());
            }

View Full Code Here

TOP

Related Classes of com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer

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.