// No:of children of any given node
int numC = node.jjtGetNumChildren();
// Loop & flag variables
int i = 0;
SimpleNode child;
// Processing the child nodes of the current node.
for (i = 0; i < numC; i++) {
child = (SimpleNode) node.jjtGetChild(i);
// Cat spec without co-indexation info in the leafnodes
if (child.type.equals("Redundant")) {
if (node.type.equals("Leafnode")) {
node.catRedundant = child.print();
continue;
}
// Processes treenode categories
if (node.type.equals("Treenode"))
child.type = "complexcat";
}
// The header node is accessed and the CCGbankId is passed on to the
// treenode root of the sentence which is processed next
if (child.type.equals("Header")) {
i++;
String temp1 = child.getHeader();
int spacePos = temp1.indexOf(' ');
if (spacePos > 0)
temp1 = temp1.substring(0, spacePos);
child = (SimpleNode) node.jjtGetChild(i);
child.setHeader(temp1);
// System.out.println(temp1);
}
// Xml element which is going to be generated.
Element leaf = new Element(child.type);
if (child.type.equals("complexcat")
|| child.type.equals("Treenode")
|| child.type.equals("Leafnode")) {
// Atomic categories are represented in the javacc tree as
// catSpec-aotmcat. So for such cases the catSpec child is
// skipped and the next child is accessed.
if (child.jjtGetNumChildren() == 1
&& child.type.equals("complexcat")) {
child = (SimpleNode) child.jjtGetChild(0);
// The element which is to be added to the xml
// representation
leaf = new Element("atomcat");
// Extracting the content of the node and storing it.
node.cat = child.print();
} else {
// A complexcat element is created.
leaf = ccinserter(child, leaf);
// Extracting the content of the node and storing it.
if (root.getName().equals("Leafnode")) {
node.cat = child.print();
}
if (root.getName().equals("Treenode")
&& leaf.getName().equals("complexcat")) {
// Leafnode and treenode cat spec elements created
node.cat = child.print();
}
// Recursive processing of the children of the current node
leaf = eval(child, leaf);