in xbean-spring/src/main/java/org/apache/xbean/spring/generator/DocumentationGenerator.java [119:163]
private void generateHtmlElementDetail(PrintWriter out, NamespaceMapping namespaceMapping, ElementMapping element) {
out.println("<h2>Element: <a name='" + element.getElementName() + "'>" + element.getElementName() + "</a></h2>");
boolean hasAttributes = false;
boolean hasElements = false;
for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext() && (!hasAttributes || !hasElements);) {
AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
Type type = attributeMapping.getType();
if (namespaceMapping.isSimpleType(type)) {
hasAttributes = true;
} else {
hasElements = true;
}
}
if (hasAttributes) {
out.println("<table>");
out.println(" <tr><th>Attribute</th><th>Type</th><th>Description</th>");
for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
Type type = attributeMapping.getPropertyEditor() != null ? Type.newSimpleType(String.class.getName()) : attributeMapping.getType();
if (namespaceMapping.isSimpleType(type)) {
out.println(" <tr><td>" + attributeMapping.getAttributeName() + "</td><td>" + Utils.getXsdType(type)
+ "</td><td>" + attributeMapping.getDescription() + "</td></tr>");
}
}
out.println("</table>");
}
if (hasElements) {
out.println("<table>");
out.println(" <tr><th>Element</th><th>Type</th><th>Description</th>");
for (Iterator iterator = element.getAttributes().iterator(); iterator.hasNext();) {
AttributeMapping attributeMapping = (AttributeMapping) iterator.next();
Type type = attributeMapping.getType();
if (!namespaceMapping.isSimpleType(type)) {
out.print(" <tr><td>" + attributeMapping.getAttributeName() + "</td><td>");
printComplexPropertyTypeDocumentation(out, namespaceMapping, type);
out.println("</td><td>" + attributeMapping.getDescription() + "</td></tr>");
}
}
out.println("</table>");
}
}