STGroup
からを構築しようとして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'
を区切り文字として使用したいのです$
が、これらのテンプレートをレンダリングできる正しい形式は何ですか?