The XML Schema language (XSD) is a powerful language for declaring types.
XML documents can be validated by XSD documents.
Most XML editors will create skeletal XML documents from XSD schemas.
The XSD type system is as rich as the java type system.
In fact, we can generate Java class declarations from an XSD document using the JAXB compiler.
Try generating Java code using JDeveloper's "Tools/JAXB Compiler".
Here's an XSD: