I am trying to create a simple XML-Template which so far only consists of:
<?xml version="1.0"?>
I read the file like this:
STGroup group = new STGroupDir("templates");
ST st = group.getInstanceOf("report");
st.add("analysis", ana);
String result = st.render();
System.out.println(result);
And the result is several error messages:
report.st 1:1: invalid character '<'
report.st 1:1: invalid character '?'
report.st 1:19: invalid character '?'
report.st 1:20: invalid character '>'
report.st 1:2: no viable alternative at input 'xml'
I have seen other people reading HTML tempaltes that also use tags. So what am I doing wrong?
Okay it seems I overlooked that you need to specify templates in a different snytax. Allthough this was not obvious from the examples I used:
My working template looks different now:
report (analysis) ::= <<
<?xml version="1.0"?>
>>
In addition I also changed the delimeters:
STGroup group = new STGroupDir("templates",'$','$');