Java Reference
In-Depth Information
Listing 7.7
Variable-content containers can delay type bindings
<xsd:element name= "InventoryItem"
type="i:InventoryItemType" />
O Defining the
O No schema
location in the
<xsd:import namespace="" />
<xsd:element name= "InventoryList">
<xsd:element name="InventoryItem"
maxOccurs="unbounded" />
O Use the imported
type in another
Listing 7.7 shows this approach is appropriately called the dangling type. We'll
bind to the schema location in the instance document. Using this approach,
we delay binding of the types until runtime. We can then let individual
instances define types appropriate to their application. We gain all of the bene-
fits of the first three approaches, and we enjoy the additional benefit of com-
plete type freedom. Unfortunately, as I am finishing Bitter Java , the dangling
type is not yet implemented in the major schema validators. The way around
this is to use anyType :
<xsd:element name= "InventoryItem"
type="anyType " />
XML versioning
In the section “Creating multiple interfaces,” we mentioned that we might
want to collect different versions of the same interface to preserve compatibil-
ity. With XML , we can avoid some of the problems that lead to interface ver-
sioning, but sometimes we're faced with incompatible versions of the same
schema. Here's how we can provide better versioning support:
Search WWH ::

Custom Search