Is it possible to define an XML Schema for recursive, unknown-named elements? For example:
<Bob age="72">
<FavoriteColor>"Blue"</FavoriteColor>
<Children>
<Sally age="36">
<FavoriteColor>"Green"</FavoriteColor>
<Children />
</Sally>
<Joe age="34">
<FavoriteColor>"Red"</FavoriteColor>
<Children>
<Tina age="5">
<FavoriteColor>"Blue"</FavoriteColor>
<Children />
</Tina>
<Frank age="6">
<FavoriteColor>"Yellow"</FavoriteColor>
<Children />
</Frank>
</Children>
</Joe>
</Children>
</Bob>
I'm fairly new to XSD, but I think this requires some combination of recursion and <xs:any>
.
See: Recursion in an XML schema? and how can I define an xsd file that allows unknown (wildcard) elements?
However I can't find a solution that doesn't involve rewriting my implied Person
elements with the stricter form:
<Person name="Bob" age="72">
<FavoriteColor />
<Children />
Is the original XML Schema-able?