}
// Iterate over the children of this element.
NodeList children = node.getChildNodes();
int numChildren = children.getLength();
ListData childList = newEmptyList();
Node c; Element child;
for (int i=0; i<numChildren; i++) {
c = children.item(i);
if (c instanceof Element && isProcessNode((Element) c) &&
!noAutoDataNode((Element) c)) {
child = (Element) c;
String childName =
pathConcat(path, child.getAttribute(NAME_ATTR));
childList.add(childName);
buildDefaultData(child, childName, data, definitions,
localDataLength, nodeDefinitions);
}
}
childList.setImmutable();
// truncate the nodeDefinitions StringBuffer so it only
// contains the global data definitions plus the local size
// definition (probably unnecessary, but a wise and safe thing
// to do).
nodeDefinitions.setLength(localDataLength);
if (XMLUtils.hasValue(path))
nodeDefinitions.append("#define ").append(PATH_MACRO)
.append(" ").append(esc(path)).append("\n");
if (node.hasAttribute(DashHierarchy.IMAGINARY_NODE_ATTR))
nodeDefinitions.append("#define IS_IMAGINARY_NODE\n");
if (childList.size() > 0) {
definitions.put(pathConcat(path, CHILD_LIST_ELEM), childList);
nodeDefinitions.append(NODE_DATA);
} else {
// This is a phase.