You can use the any element in a similar way as
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 preceding 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:
- 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.
- ##targetNamespace. This 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 content at all.
- lax. The XML processor will validate the content as much as
it can.
- strict. The XML processor will validate all the content.
- The minOccurs value is the number of times
the any element must appear in an instance document. You
can select 0 if you want the element to be optional;
otherwise, select 1.
- The maxOccurs value is the maximum number
of times an any element can appear in an instance document.
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.
- Click the Extensions tab if you want to
add application information elements to your annotations of schema components.
The Extensions page allows you to specify the
schema and add XML content to your annotations.
(c) Copyright 2001, World Wide Web (Massachusetts Institute of
Technology, Institut National de Recherche en Informatique et en Automatique,
Keio University).