Adding an any element
You can use the any element to provide something similar to a DTD's ANY content model, however, it must be done in conjunction with namespaces. This enables you to include any well-formed XML content, such as an HTML Web page that conforms to XHTML 1.0 syntax.
For example:
<element name = "MyWebPage"> <complexType> <any namespace ="http://www.w3.org/1999/xhtml> < minOccurs="1" maxOccurs="unbounded" processContents="skip"/> </complexType> </element>The above schema fragment allows a <MyWebPage> element to contain any well-formed XHTML data that appears in the specified namespace.
The following instructions were written for the Resource perspective, but they will also work in many other perspectives.
To add an any element, follow these steps:
- In the Outline view, right-click the content model that you want to work with and click Add Any.
- Select the new any element.
- In the Properties view of the schema editor, for a namespace value, you can select ##any (this allows any well-formed XML from any namespace), ##local (this allows any well-formed XML that is not declared to be in a namespace), ##other (this allows any well-formed XML that is not from the target namespace of the type being defined) or ##targetNamespace (which is shorthand for the target namespace of the type being defined).
- For a processContents value, you can select skip (the XML processor will not validate the attribute content at all), lax(the XML processor will validate the attribute content as much as it can), or strict (the XML processor will validate all the attribute content).
- The minOccurs value is the number of times the any element must appear. You can select 0 if you want the element to be optional; otherwise, select 1.
- The maxOccursvalue is the maximum number of times an any element may appear. You can select 0, 1, or, to indicate there is no maximum number of occurrences, unbounded.
- Click the Documentation tab if you want to provide any information about this element. The Documentation page is used for human readable material, such as a description, and the App Info page can be used to provide information for applications.
(c) Copyright 2001, World Wide Web (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University).