XSD / extensibility

Extending XML Schemas Safely

Design XML Schema extension points with type derivation, substitution groups, wildcards and version-aware consumer policies.

Updated2026-07-21
ScopeTechnical reference

Extension is a contract

An extension point promises that additional content can appear and defines how validators and consumers should handle it. Adding xs:any without a namespace or processing policy moves uncertainty into every consumer instead of creating safe extensibility.

Type derivation

Complex types can extend a base type with additional content or restrict it under XSD rules. Derivation exposes relationships to schema-aware tools, but generated object models vary and long inheritance chains become difficult to evolve. Prefer shallow, meaningful type relationships.

Substitution groups

A global head element can allow other global elements to substitute for it. This supports element-level polymorphism and distributed extensions, but it depends on global declaration identity and requires consumers to handle members they may not know at compile time.

Wildcards

A wildcard should specify the intended namespace set and processContents mode. Strict processing provides the strongest validation when declarations are available. Lax or skip processing may be required at open ecosystem boundaries, but the resulting trust boundary must be documented.

Consumer policy

Extensible XML succeeds only when consumers tolerate and preserve allowed unknown content as required. Test old consumers against new extension examples, and define whether unknown content is ignored, retained, rejected or surfaced to an operator.

Implementation notes

Design an extension point from a concrete future example. Identify who owns the extension, where it can appear, which namespaces are accepted and whether unknown content must survive a read-modify-write cycle. Encode those decisions with the narrowest available mechanism instead of adding xs:any to every complex type as a generic precaution.

Use type derivation when the derived type truly preserves the meaning and substitutability of the base. Use substitution groups for an open family of element declarations with stable global identity. Use wildcards at ecosystem boundaries where independently governed vocabularies must coexist. Each mechanism creates different requirements for imports, code generation and consumer dispatch.

Failure modes

Lax or skipped wildcard processing can admit markup an application later treats as trusted. Strict processing can fail operationally when extension schemas are unavailable. Define resource resolution and trust separately from the XSD syntax, and expose whether an accepted extension was validated, retained without validation or discarded.

Generated bindings often handle extension points differently from tree-based APIs. A schema may look elegant but map to raw element collections or rigid inheritance that loses unknown content. Test the actual consumer libraries before freezing the public contract, including serialization after an older client reads a newer instance.

Review checklist

  • Extension owner identified
  • Allowed namespaces constrained
  • Processing mode justified
  • Unknown content preserved as required
  • Bindings round-trip tested
  • Security boundary documented

Questions for a design review

Use this reference to make a review decision, not merely to recognize terminology. Record the concrete document, schema, processor or consumer being discussed; the language and processor versions; and the behavior that must remain compatible. A useful review produces fixtures and an owner for every unresolved assumption.

  • What executable example or test demonstrates the intended behavior for extension is a contract?
  • What executable example or test demonstrates the intended behavior for type derivation?
  • What executable example or test demonstrates the intended behavior for substitution groups?
  • What executable example or test demonstrates the intended behavior for wildcards?
  • What executable example or test demonstrates the intended behavior for consumer policy?

Include at least one ordinary case, one boundary case and one deliberately invalid or unsupported case. Check the result in the actual production toolchain, because parsers, validators, code generators and reasoners do not all implement the same optional features. Store the selected contract version with the test result, then repeat the review when a dependency, namespace, profile or public declaration changes.

Extensible content models · Schema versioning

Query set / FAQ

Frequently asked questions

01What does the Extending XML Schemas Safely reference cover?

Design XML Schema extension points with type derivation, substitution groups, wildcards and version-aware consumer policies.

02When should I use this Technical reference guidance?

Use it when designing, reviewing or updating a system that depends on Extending XML Schemas Safely. Apply the guidance to a concrete example and record any project-specific policy that goes beyond the standard.

03How can I verify a Extending XML Schemas Safely design decision?

Create a minimal positive example, a negative or boundary example, and run both through the same processors and consumer versions used in production. Keep the expected outcome with the fixture so the decision remains reproducible.

04What are the limitations of this Technical reference reference?

The page explains a focused technical decision; it does not replace the complete specification, processor documentation or integration testing. Version-specific behavior and external dependencies must still be verified in the target environment.