This afternoon I had a rapid introduction to the XML Schema language. If you have not done so already, see my first post on XML Schema. In addition to being able to specify an element format (or type), you can specify its cardinality. This is done with the element attributes minOccurs and maxOccurs. The minOccurs attribute default to 1, can be set to whatever you desire, and can represent an optional element if set to 0. The maxOccurs attribute defaults to the lesser of 1 or minOccurs. If you want to specify that there is no maximum, the maxOccurs attribute can be specified as "unbounded".
Previously I had introduced the concept of complex types. They represent attributes, or elements made up other sub elements. XML Schema allows you to specify fine control what a particular complex type element requires. This is done in part by what's known as a compositor property. The valid compositors are sequence, choice, and all. A sequence compositor means that all pieces of a complex type are required and must be in a specific order. A choice compositor allows you to specify the different components that a composite type can optionally have. And an all compositor allows specification of a list of complex type parts, each of which can have 0 or 1 occurrences in the whole element.
XML Schema allows you to define a global element. Such an element must be a direct child of the root element. The opposite of this is a local element which is defined within the compositor. You can also define new data types. A simple new data type is one which derives from a built in type, but restricts the range of possible values through a mechanism called a facet. I will not enumerate all the possible facet varieties here. You can also create a new data type which is of the complex variety.
XML by itself has a way to add a comment. That should be used if you have an internal comment. XML Schema has another form of adding comments to an XML file. However these comments get pulled into the official documentation. So make sure they are appropriate for public consumption. You can use XML Schemas with XML namespaces. There is a little tricky syntax change that must be applied to both the XML File and the XML Schema to make namespaces work. XML Schemas can include other XML Schemes (.xsd files). Finally you can use a tool to convert an old style Document Type Definition (DTD) into the newer XML Schema language.
Free Laundry
-
Apparently a lot of apartment buildings have coin operated laundry machines
in the basement. And guess what? You can order a key to unlock the payment
me...