我正在尝试STGroup
从 a构建 a,String
但它抱怨无效字符和缺少模板:
final String templates = "a(x) ::= <li>$x.fname$ $x.lname$</li>\n" +
"b(persons) ::= <ul>$persons:a()$</ul>\n";
final STGroup grp = new STGroupString("mysource", templates, '$', '$');
这是它喷出的错误:
mysource 1:10: invalid character '<'
mysource 1:10: missing template at 'li'
mysource 1:12: invalid character '>'
mysource 1:13: invalid character '$'
mysource 1:10: garbled template definition starting at 'li'
mysource 1:14: garbled template definition starting at 'x'
mysource 1:21: invalid character '$'
mysource 1:23: invalid character '$'
mysource 1:16: garbled template definition starting at 'fname'
mysource 1:24: garbled template definition starting at 'x'
mysource 1:31: invalid character '$'
mysource 1:33: invalid character '<'
mysource 1:34: invalid character '/'
mysource 1:26: garbled template definition starting at 'lname'
mysource 1:36: invalid character '>'
mysource 1:34: garbled template definition starting at 'li'
mysource 2:16: invalid character '<'
mysource 2:16: missing template at 'ul'
mysource 2:18: invalid character '>'
mysource 2:19: invalid character '$'
mysource 2:16: garbled template definition starting at 'ul'
mysource 2:20: garbled template definition starting at 'persons'
mysource 2:31: invalid character '$'
mysource 2:33: invalid character '<'
mysource 2:34: invalid character '/'
mysource 2:36: invalid character '>'
mysource 2:34: missing '::=' at 'ul'
mysource 2:34: missing template at 'ul'
mysource 2:28: redefinition of template a
mysource 2:34: garbled template definition starting at 'ul'
我想使用$
作为我的分隔符,能够呈现这些模板的正确格式是什么?