Java Reference
In-Depth Information
transaction messages. The key to taking advantage of this investment is to
build schemas that can be extended so that future negotiations are easier. Let's
examine some of the practices that can get in the way of extensible schemas.
7.6.1
Name collisions
XML shares a primary goal with object technologies: reuse. When we're build-
ing a large schema, we'll often combine parts of existing schemas. Suppose we
own a company that sells mountain bikes. Like many such companies, ours
doesn't make its own frames. Instead, it buys parts from disparate sources and
assembles the bikes. Let's say we want to build an XML specification describing
a bike, and we plan to use this specification to communicate with our
distributors and suppliers. We want to use one vendor's frames and another
vendor's components. To build the specification, we combine the component
set definitions from an existing standard specification with the frame portion of
a competing specification for an XML bike definition. We round it out with
some custom XML describing our proprietary wheel sets and forks. Figure 7.9
shows our plan for the combined XML document schema. We've reused por-
tions of specifications for the frame and component ( frame.xsd and comp.xsd )
and combined those with new schemas for the wheel set and front suspension.
We've called those new schemas wheel.xsd and fork.xsd . We combine all the
schemas to form a bike specification that meets our needs. The problem is that
XML allows only a single definition for entities, attributes, and type definitions.
Shortsighted designers might decide to ignore name collisions altogether.
Some organizations, through either ignorance or the belief that namespaces
are cumbersome, decide to control naming collisions with prefixes and longer
bike.xsd
wheels.xsd
frame.xsd
comp.xsd
fork.xsd
Composite
Reused
Proprietary
Figure 7.9 With XML, we can build a new schema out of existing specifications. In this
example, we combine reused schemas for the bike frame and components with proprietary
schemas for wheels and the fork, and come up with an entirely new specification with a fraction
of the total effort.
Search WWH ::




Custom Search