out.println( " </tr>" );
for( Map.Entry<String,PropertyDef> entry : properties.entrySet() )
{
final String xmlPath = entry.getKey();
final PropertyDef property = entry.getValue();
final String cardinality;
if( property instanceof ValueProperty )
{
if( property.hasAnnotation( Required.class ) )
{
cardinality = "1";
}
else
{
cardinality = "0 or 1";
}
}
else if( property instanceof ElementProperty )
{
cardinality = "0 or 1";
}
else if( property instanceof ListProperty )
{
cardinality = "0 or more";
}
else
{
throw new IllegalStateException();
}
out.println( " <tr>" );
out.println( td( xmlPath ) );
out.println( td( cardinality ) );
out.println( " <td>" );
if( property.hasAnnotation( Documentation.class ) )
{
documentation( out, property.getAnnotation( Documentation.class ) );
}
else
{
out.println( " " );
}
if( property instanceof ElementProperty || property instanceof ListProperty )
{
boolean skip = false;
final ElementType childType = property.service( PossibleTypesService.class ).types().first();
final SortedSet<PropertyDef> childTypeProperties = childType.properties();
if( childTypeProperties.size() == 1 )
{
final PropertyDef childTypeProperty = childTypeProperties.first();
if( childTypeProperty instanceof ValueProperty )
{
if( childTypeProperty.hasAnnotation( XmlBinding.class ) )
{
final XmlBinding b = childTypeProperty.getAnnotation( XmlBinding.class );
if( b != null && b.path().length() == 0 )
{
skip = true;
}
}
else if( childTypeProperty.hasAnnotation( XmlValueBinding.class ) )
{
final XmlValueBinding b = childTypeProperty.getAnnotation( XmlValueBinding.class );
if( b != null && b.path().length() == 0 )
{
skip = true;
}