XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.

advertisement

Understanding XML Schemas
by Norman Walsh | Pages: 1, 2, 3, 4, 5, 6, 7

Features

XML Schema offer a range of new features.

  • Richer datatypes. Part 2 of the Schema draft defines booleans, numbers, dates and times, URIs, integers, decimal numbers, real numbers, intervals of time, etc.

    In addition to these simple, predefined types, there will be facilities for creating other types and aggregate types (although the mechanisms have not been finalized as of the 06 May 1999 draft).

  • User defined types, called Archetypes in the draft. An archetype allows you to define your own named datatype. For example, you might define a "PostalAddress" datatype and then define two elements, "ShippingAddress" and "BillingAddress" to be of that type.

    This is a more powerful than simply defining the two elements to have the same structure because the shared archetype information is available to the processor.

  • Attribute grouping. It's not uncommon to have several attributes that "go together". For example, common attributes that apply to all elements or several attributes that augment graphic or table elements. Attribute grouping allows the schema author to make this relationship explicit. In DTDs, the grouping can be achieved with a parameter entity, simplifying the process of authoring a DTD, but the information is not passed on to the processor.

  • Refinable archetypes, or "inheritance". This is probably the most significant new feature in XML Schemas.

    A content model defined by a DTD can be described as "closed": it describes all and only what may appear in the content of the element. XML Schema admit two other possibilities: "open" and "refinable". In an open content model, all required elements must be present, but it is not an error for additional elements to also be present. A refinable content model is the middle ground: additional elements may be present, but only if the schema defines what they are. (Consider a schema that extends another: it might refine the content model of some element type to add new elements.)

  • Namespace support. Since the introduction of Namespaces in XML, validation has become much more difficult. In fact, until the XML Schema work is completed, it just isn't practical to validate documents that use namespaces.

    The XML Schema WD describes mechanisms for schema composition (allowing schemas for multiple namespaces to be combined in a rational way so that validation can be performed) and support for namespaces.

Pages: 1, 2, 3, 4, 5, 6, 7

Next Pagearrow