Referential integrity in the XML schema editor

The XML schema editor has a built-in mechanism to handle referential integrity issues. When you delete certain nodes, clean up for any nodes affected will automatically occur.

When you define a complex type, you can add a content model to it and reference a global element.

For example:
<schema>
 <element name="comment" type="string">
 <complexType name="Items">
 <sequence>
 <element ref="comment">
 </sequence>
 </complexType>
</schema>

If the global element (comment) was deleted, all references to it would be in error. However, when you delete the global element, the XML schema editor will clean up using the following algorithm:

  • If there are one or more global elements in the schema, it will change all existing references to the first global element.
  • If there is no global element, then it will delete the element reference from the content model.

Similar cleanup operations are performed when other types of objects are deleted. The following lists describes various cleanup operations.

Deleting a global attribute will cause the following cleanup:

  • Any item that references the deleted global attribute will be reset using the preceding algorithm.

Deleting a complex type will cause the following cleanup:

  • Any element type that is set to the deleted complex type will be reset to the string type.
  • Any complex type that derives from the deleted complex type will be reset to no derivation.

Deleting a simple type will cause the following cleanup:

  • Any attribute type that is set to the deleted simple type will be reset to the string type.
  • Any element type that is set to the deleted simple type will be reset to the string type.
  • Any simple type that derives from the deleted simple type will be reset to string as its base type.

Deleting a group or attribute group will cause the following cleanup:

  • Any complex type that references the deleted group or attribute group will be reset using the algorithm similar to the one described earlier for deleted global elements.

Deleting included and imported schema

If an included or imported schema is deleted, you must manually reset the following type references as appropriate:
  • Global element and element's type
  • Attribute type
  • Complex type derivation
  • Simple type derivation
They will not automatically be reset if an included or imported schema is deleted.

Related concepts
XML schema editor

Related tasks

Editing XML schema properties