I want to deduce from an XML schema the couple (parentTag, childTag)
such that it is allowed for parentTag
to contain multiple instances of childTag
as direct children.
Doing that by hand, I look for the maxOccurs
attribute in the schema, look the element tag, and tag of the direct parent.
For example, from
<xs:complexType name="aType">
<xs:sequence>
<xs:element ref="B" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="A" type="aType">
<xs:element name="ANOTHER" type="aType">
I should obtain the couples (A,B)
and (ANOTHER,B)
.
I have a working solution using XSLT to convert my schema to a list of such (parentTag, childTag)
couples.
Is there an elegant way to do this in Java ? Which library would you recommend to implement this ?