- The Role of Models in XML Applications
- What Is UML?
- Conceptual Models of XML Vocabulary
- Design Models of XML Schemas
- Tips for Success
- References
Design Models of XML Schemas
Now that we've created a conceptual model of our XML vocabulary's content and gained approval of all business and technical stakeholders, what next? As hinted in previous sections, there are numerous alternatives available when mapping this model to XML schema constructs. Are the UML attributes and association ends mapped to XML attributes or elements? How is UML generalization of classes and datatypes mapped into schema definitions? How does this mapping differ when the target schema language is changed from W3C XML Schema to RELAX NG? What about DTDs?
If you refer to the schema development process illustrated in Figure 1, the next design task also depends on whether this vocabulary is data or text-oriented. Because the purchase order vocabulary is data-oriented, most of the remaining design decisions relate to deployment issues such as these:
Developer conventions for using XML attributes or child elements
Datatype alignment with other sources and destinations of data to be exchanged using this vocabulary
Anticipated future requirements for extending this vocabulary or combining it with other XML namespaces
If this were a text-oriented application, content managers and authors would have further input on design choices. For example, most human authors prefer XML document structures that avoid excessive use of container elements to group related content elements, whereas this is common practice in data-oriented applications. Also, the order of elements in a document is often more important to human authors and readers than it is to data parsing.
This article is the first of three articles on modeling XML vocabularies. Its focus on capturing the conceptual model of a vocabulary is the logical first step in the development process. The second article presents a list of design choices and alternative approaches for mapping UML to W3C XML Schema. The UML model presented in this first article will be refined to reflect the design choices made by the authors of the W3C's XML Schema Primer, where this example originated. For our purposes, these authors are the stakeholders of system requirements.
The third article introduces a UML profile for XML schemas that allows all detailed design choices to be added to the model definition and then used to automatically generate a complete schema. Our end result is a UML model that is used to generate a W3C XML Schema, which can successfully validate XML document instances copied from the Schema Primer specification. Along the way, I'll introduce a web-based tool that we have developed to generate schemas from UML and reverse-engineer schemas into UML.