ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index
Contents > Wildcard patterns

Wildcard patterns

Attribute from any namespace

The root element named "root" can have arbitrary number of any attributes from any namespace.

The element "anyName" says that the attribute can have any name from any namespace. The "anyName" and "nsName" elements (which represent an infinite number of names) must be repeated, so you can say only that you allow either 0+ (zeroOrMore) or 1+ (oneOrMore) such attributes. See (7.3. Restrictions on attributes).

...
Attributes from namespace other then target namespace (which is null)

The root element named "root" can have arbitrary number of any attributes from namespace other than the target namespace or null namespace. In this case, the "namespace" attribute will be set to value "##other". It will allow all attributes which are from namespace other than null namespace.

The element "anyName" says that the attribute can have any name from any namespace. We will exclude all attributes from empty namespace using the "except" and "nsName" elements.

...
Attributes from namespace other than target namespace (which is not null)

The root element named "root" can have arbitrary number of any attributes from namespace other than the target namespace. The target namespace is not null here. The "namespace" attribute will be set to value "##other". It will allow all attributes which are from namespace other than targetNamespace or null.

The element "anyName" says that the attribute can have any name from any namespace. We will exclude all attributes from empty namespace and the "target namespace" using the "except" and "nsName" elements.

...
Attributes from some particular namespace

The root element named "root" can have an arbitrary number of attributes from some particular namespaces, let's say "http://bar" and "http://baz". The "namespace" attribute will be set to value "http://bar http://baz".

We will specify all attributes from namespaces "http://bar" and "http://baz" using the "nsName" element.

...
Attributes must not be from some particular namespaces

The root element named "root" can have an arbitrary number of attributes from any namespace, except let's say "http://bar" and "http://baz". I do not know, how to do this with XML Schema.

We will exclude all attributes from namespaces "http://bar" and "http://baz" using the "except" and "nsName" elements.

...
Just one element from any namespace

The root element named "root" must have one arbitrary element from any namespace.

The element "anyName" says that the element can have any name from any namespace.

...
Arbitrary number of elements from any namespace

The root element named "root" can have an arbitrary number of any elements from any namespace.

The element "anyName" says that the elements can have any name from any namespace. If we want to allow an arbitrary number of such attributes, we need to use the "zeroOrMore" element

...
Exact number of elements from any namespace

The root element named "root" can have 1 to 3 elements from any namespace.

The element "anyName" says that the elements can have any name from any namespace. We will use the "optional" element.

...
Elements from namespace other than target namespace (which is not null)

The root element named "root" can have an arbitrary number of any elements from namespace other than the target namespace. The target namespace is not null here. The "namespace" attribute will be set to value "##other". It will allow all elements which are from namespace other than targetNamespace.

The element "anyName" says that the attribute can have any name from any namespace. We will exclude all attributes from the "target namespace" using the "except" and "nsName" elements.

...
Elements from namespace other than target namespace (which is null)

The root element named "root" can have an arbitrary number of any elements from namespace other than the target namespace. The target namespace is null here. The "namespace" attribute will be set to value "##other". It will allow all elements which are from namespace other than null namespace.

The element "anyName" says that the attribute can have any name from any namespace. We will exclude all attributes from the null namespace ("target namespace") using the "except" and "nsName" elements.

...