ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index
Contents > Including

Including

Target namespaces are the same (non-null)

Both target namespaces are the same, so inclusion won't have any further effects on the namespace settings in the included schema, although the form of the element "x" in the included schema is "qualified". Schema Representation Constraint: Inclusion Constraints and Semantics .

Both target namespaces are the same, so inclusion won't have any further effects on the namespace settings in the included schema, although the form of the element "x" in the included schema is "unqualified".

In this example there is no "ns" attribute in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one).

...
Target namespaces are the same (null)

Both target namespaces are the same (null), so inclusion won't have any further effects on the namespace settings in the included schema. Schema Representation Constraint: Inclusion Constraints and Semantics .

...
Including document has non-null target namespaces, included null target namespace

Because the included schema does not have targetNamespace attribute and the form is "qualified", the target namespace will be "inherited" from the including schema. Schema Representation Constraint: Inclusion Constraints and Semantics, 2.3 .

...
Including document has null target namespaces, included non-null target namespace

Including document has null target namespaces, included non-null target namespace. This case is not allowed. Schema Representation Constraint: Inclusion Constraints and Semantics, 2 .

...
The wildcard "xsd:any" and inclusions

When the target namespace of the included schema is null, it is changed to the target namespace of the including document. This process includes also the wildcards: "xsd:any" elements. In this example, the included schema allows one arbitrary element from target namespace, so after inclusion, the "##targetNamespace" will stand for "http://foo", not for null-namespace. Schema Representation Constraint: Inclusion Constraints and Semantics, 3.2.2 .

...
The wildcard "xsd:anyAttribute" and inclusions

When the target namespace of the included schema is null, it is changed to the target namespace of the including document. This process includes also the wildcards: "xsd:anyAtribute" elements. In this example, the included schema allows one arbitrary attribute from namespace other than target namespace, so after inclusion, the "##other" will forbid attributes from both null-namespace and "http://foo" namespace. Schema Representation Constraint: Inclusion Constraints and Semantics, 3.2.2 .

...
Including in Relax NG - externalRef element, ns attribute

When using the "externalRef" element, the root element of the included file must match the syntax of a pattern. In this example there is no "ns" attribute in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one). See externalRef element.

In this example the "ns" attribute is set to null-namespace in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one).

...
Including in Relax NG - include element, ns attribute

When using the "include" element, the included file must have the "grammar" root element. In this example there is no "ns" attribute in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one). See include element.

In this example the "ns" attribute is set to null-namespace in the included document. During the schema processing, the document is included before the "ns" attribute is propagated, so the value of "ns" attribute will propagate to the included document. We validate the XML files against the first Relax NG schema (which includes the second one).

...