The Apache Software Foundation > Apache XMLBeans
 

AbstractTypes Sample

Description

Author: Radu Preotiuc

Available: 2005-02-07

Versions: xmlbeans-1.0.3, xmlbeans-v2

This sample illustrates the building and use of abstract XmlSchema types in XmlBeans.

The scenario is simple: someone declares a generic XmlSchema containing the basic structure of a document with abstract, generic types and delivers a .jar file containing the compiled version of that Schema. We then define our own customization of that schema implementing the abstract types, we compile this XmlSchema using the .jar that was provided and create a sample instance document using XmlBeans. Here are the steps:

  1. Create the schema file "abstractBase.xsd" and compile it to abstractbase.jar.
  2. Create a Schema that implements the abstract types defined in "abstractBase.xsd", and compile it with "abstractbase.jar" on the classpath.
  3. Use the jars created in steps 1 and 2 to create an instance document using the concrete types.

Files