It looks to me as if you are using JJT. Here are 3 ways to convert the input file to an XML file using JavaCC or JJT.
It is easy to edit the generated
SimpleNode
class so that it outputs XML -- or whatever format you want.An alternative is to use JavaCC rather than JJT and to make SAX calls so that your parser constructs an XML document. Then it is easy to output the XML document.
A third option is to stick with JJT and modify the
SimpleNode
class to produce an XML document (using either SAX or DOM). Then the XML document can outputted.