Note that we didn't model the customer ID. Columns like IDs that don't represent information that would be meaningful outside the context of the relational database typically shouldn't be modeled in XML documents. The exception to this rule is when a relationship constraint forces a pointer to an element to be added to your XML schema—but again, we'll learn more about modeling relationships in the next article.
An XML document that validates against this document would look like this:
Using the Ref attribute
The other approach is to use the ref attribute on an element to indicate its name and type based on a global element you've declared elsewhere in your schema. Using this modeling technique, all elements that contain data points are defined as global elements (at the root of the
This schema is functionally equivalent to the previous example: that is, any document that validates against the first example will validate against the second, and vice versa.
Modeling data points as attributes
In XML Schemas, when modeling data points as attributes you have the same two options as if you are modeling the data points with elements: you can either declare the attributes directly using name and type, or you can reference global-level attributes using ref. Let's see some quick examples of each.
Modeling attributes using Name and Type
As before, we include attribute declarations inside of the element complexType with which they are associated. The name of the attribute is specified in the name attribute of the
![]()
![]() | Modernizing Cobol for the adaptive enterprise from Hewlett-Packard LP and Intel Corp. For independent software ve... |
![]() | Multithreaded technology and multi-core processors by Craig Szydlowski, Infrastructure Processor Division, Intel Corp. ... |
If you're interested in this topic, these articles may be helpful:
![]() | Source code for 'XML security layers, part 2: core technologies—XML encryption and XML signature' by Manish Verma, principal architect, Second Foundation. First publ... |
![]() | XmlPad 2.2. free download from WMHelp.com XMLPad is based on the unique custom-developed XML ... |
![]() | Relationships: modeling relational data in XML, part 3 by Kevin Williams, founder and CEO, Blue Oxide Technologies. In thi... |
![]() | Core Foundation XML parser from Apple Inc. Core Foundation provides a nonvalidating parser t... |
![]() | XMLSpy Home Edition 2005 from Altova Altova XMLSpy 2005 Home Edition is a free entry level X... |
![]()
Related Jobs:


