*/
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()));
// JCR 2.0 extension
ntDef.setAttribute(ISABSTRACT_ATTRIBUTE, Boolean.toString(nt.isAbstract()));
// JCR 2.0 extension
ntDef.setAttribute(ISQUERYABLE_ATTRIBUTE, Boolean.toString(nt.isQueryable()));
// declared supertypes
Element supertypes = DomUtil.addChildElement(ntDef, SUPERTYPES_ELEMENT, null);
for (NodeType snt : nt.getDeclaredSupertypes()) {
DomUtil.addChildElement(supertypes, SUPERTYPE_ELEMENT, null, snt.getName());
}
// declared child node definitions
for (NodeDefinition aCnd : nt.getChildNodeDefinitions()) {
if (aCnd.getDeclaringNodeType().getName().equals(nt.getName())) {
ntDef.appendChild(NodeDefinitionImpl.create(aCnd).toXml(document));
}
}
// declared property definitions
for (PropertyDefinition aPd : nt.getPropertyDefinitions()) {
if (aPd.getDeclaringNodeType().getName().equals(nt.getName())) {
ntDef.appendChild(PropertyDefinitionImpl.create(aPd).toXml(document));
}
}
String primaryItemName = nt.getPrimaryItemName();
if (primaryItemName != null) {
ntDef.setAttribute(PRIMARYITEMNAME_ATTRIBUTE, primaryItemName);
}
report.appendChild(ntDef);
}