*/
public Element toXml(Document document) {
Element report = document.createElement(NODETYPES_ELEMENT);
// loop over the nodetypes to be returned in the report
while (ntIter.hasNext()) {
NodeType nt = ntIter.nextNodeType();
Element ntDef = document.createElement(NODETYPE_ELEMENT);
ntDef.setAttribute(NAME_ATTRIBUTE, nt.getName());
ntDef.setAttribute(ISMIXIN_ATTRIBUTE, Boolean.toString(nt.isMixin()));
ntDef.setAttribute(HASORDERABLECHILDNODES_ATTRIBUTE, Boolean.toString(nt.hasOrderableChildNodes()));
// declared supertypes
NodeType[] snts = nt.getDeclaredSupertypes();
Element supertypes = DomUtil.addChildElement(ntDef, SUPERTYPES_ELEMENT, null);
for (int i = 0; i < snts.length; i++) {
DomUtil.addChildElement(supertypes, SUPERTYPE_ELEMENT, null, snts[i].getName());
}
// declared childnode defs
NodeDefinition[] cnd = nt.getChildNodeDefinitions();
for (int i = 0; i < cnd.length; i++) {
if (cnd[i].getDeclaringNodeType().getName().equals(nt.getName())) {
ntDef.appendChild(NodeDefinitionImpl.create(cnd[i]).toXml(document));
}
}
// declared propertyDefs
PropertyDefinition[] pd = nt.getPropertyDefinitions();
for (int i = 0; i < pd.length; i++) {
if (pd[i].getDeclaringNodeType().getName().equals(nt.getName())) {
ntDef.appendChild(PropertyDefinitionImpl.create(pd[i]).toXml(document));
}
}
String primaryItemName = nt.getPrimaryItemName();
if (primaryItemName != null) {
ntDef.setAttribute(PRIMARYITEMNAME_ATTRIBUTE, primaryItemName);
}
report.appendChild(ntDef);
}