Handling Absent Components

The XSD 1.0 and 1.1 Recommendations both say that a schema should not be treated as invalid merely because it contains unresolved references to absent schema components (for example an xs:attribute declaration that refers to a named type which is not declared in the schema). The specification suggests that such a schema should be usable for validation provided that the missing components are never used.

However, this strategy has complications:

By default therefore, Saxon treats missing component references as a compile-time error in the schema.

A configuration option, Feature.ALLOW_UNRESOLVED_SCHEMA_COMPONENTS.name, is available to change this behavior. If this option is set, the schema processor attempts to repair the schema to make it usable. For example, a reference to a missing type is replaced by a reference to xs:error (which has no valid instances); a reference to a missing attribute group or model group is replaced by a reference to an empty attribute group or model group; a reference to a missing element or attribute declaration is replaced by a reference to a local element or attribute declaration with a declared type of xs:error.

One case where Saxon does not attempt a repair is where a type is derived from an absent base type. This is always a fatal error.

It is not possible to generate an SCM file when this configuration option is set; SCM files cannot contain dangling references.