Metawidget already has an XmlSchemaInspector which may do what you need.
Beyond that, Java Metawidget's internal inspection format is already XML (albeit a String of XML, to avoid dependencies). See section 2.2.6 in the documentation:
<inspection-result xmlns="http://metawidget.org/inspection-result" version="1.0">
<entity type="com.myapp.Person">
<property name="name" required="true"/>
<property name="age" minimum-value="0"/>
</entity>
</inspection-result>
So you would need to create your own Inspector, that read your own XML format, and manipulated it into the format above. Then return that as a String.
See section 2.2.7 in the documentation. For inspecting XML files, BaseXmlInspector
assists in opening and traversing through the XML, as well as merging multiple XML files into one (e.g. merging multiple Hibernate mapping files).
It also lets you work with parsed XML as Maps, which is a bit easier, and does the conversion for you. See:
protected Map<String, String> inspectProperty( Element toInspect ) {
if ( !"field".equals( toInspect.getNodeName() ) )
return null;
Map<String, String> attributes = CollectionUtils.newHashMap();
attributes.put( NAME, toInspect.getAttribute( getNameAttribute() ) );
attributes.put( TYPE, toInspect.getAttribute( getTypeAttribute() ) );
return attributes;
}