Package org.apache.shale.clay.parser

Examples of org.apache.shale.clay.parser.Token


               int e = snippet.getBuffer().indexOf(Parser.END_CHARSET_TOKEN, s);
               AttributeTokenizer tokenizer = new AttributeTokenizer(snippet.getBuffer(), s, e, 1, 0);
               Iterator ti = tokenizer.iterator();
               while (ti.hasNext()) {
                   Map.Entry attribute = (Map.Entry) ti.next();
                   Token key = (Token) attribute.getKey();
                   //check the attribute name, we are only interested
                   //in "charset"
                   if (key != null && key.getRawText() != null
                       && key.getRawText().equalsIgnoreCase("charset")) {
                       Token value = (Token) attribute.getValue();

                       //look for the value of the charset attribute
                       if (value != null && value.getRawText() != null) {
                          // if it is supported, use the value for the encoding
                          if (Charset.isSupported(value.getRawText())) {
                              enc = value.getRawText();
                          } else {
                              log.error(messages.getMessage("template.encoding.notsupported",
                                      new Object[] { value.getRawText() }));
                          }
                       }
                   }
               }
            }
View Full Code Here


                continue next;
            }

            AttributeBean original = null;
            Token valueToken = (Token) e.getValue();
            if (valueToken != null) {
                original = target.getAttribute((String) e.getKey());
                if (original != null) {
                    createAttribute(original, valueToken.getRawText(), target);
                } else  {
                    //any token that is not an attribute in the target becomes a symbol
                    StringBuffer identifier = new StringBuffer((String) e.getKey());
                    identifier.insert(0, '@');
                    SymbolBean symbol = new SymbolBean();
                    symbol.setName(identifier.toString());
                    symbol.setValue(valueToken.getRawText());
                    target.addSymbol(symbol);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.parser.Token

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.