blob: 8c33e5f26c672a5bdda411fbd5cb07e2c90e07d1 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<!-- /*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/ -->
<link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" />
<title>Referential integrity</title>
</head>
<body id="rrefintg"><a name="rrefintg"><!-- --></a>
<h1 class="topictitle1">Referential integrity in the XML schema editor</h1>
<div><p>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.</p>
<div><p>When you define a complex type, you can add a content model to
it and reference a global element. </p><div class="skipspace"><div class="p">For example:<pre>&lt;schema&gt;
&lt;element name="comment" type="string"&gt;
&lt;complexType name="Items"&gt;
&lt;sequence&gt;
&lt;element ref="comment"&gt;
&lt;/sequence&gt;
&lt;/complexType&gt;
&lt;/schema&gt;</pre>
</div>
<p>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:</p>
<ul><li>If there are one or more global elements in the schema, it will change
all existing references to the first global element.</li>
<li>If there is no global element, then it will delete the element reference
from the content model.</li>
</ul>
<p>Similar cleanup operations are performed when other types of objects
are deleted. The following lists describes various cleanup operations. </p>
<p>Deleting
a global attribute will cause the following cleanup:</p>
<ul><li>Any item that references the deleted global attribute will be reset using
the preceding algorithm.</li>
</ol>
</ul>
<p>Deleting a complex type will cause the following cleanup:</p>
<ul>
<li>Any element type that is set to the deleted complex type will be reset
to the <tt class="sysout">string</tt> type.</li>
<li>Any complex type that derives from the deleted complex type will be reset
to no derivation.</li>
</ul>
<p>Deleting a simple type will cause the following cleanup:</p>
<ul>
<li>Any attribute type that is set to the deleted simple type will be reset
to the <tt class="sysout">string</tt> type.</li>
<li>Any element type that is set to the deleted simple type will be reset
to the <tt class="sysout">string</tt> type.</li>
<li>Any simple type that derives from the deleted simple type will be reset
to <tt class="sysout">string</tt> as its base type.</li>
</ul>
<p>Deleting a group or attribute group will cause the following cleanup:</p>
<ul>
<li>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.</li>
</ul>
</div>
<div class="section"><h4 class="sectiontitle">Deleting included and imported schema</h4><div class="p">If an included
or imported schema is deleted, you must manually reset the following type
references as appropriate: <ul><li>Global element and element's type</li>
<li>Attribute type</li>
<li>Complex type derivation</li>
<li>Simple type derivation</li>
</ul>
They will not automatically be reset if an included or imported schema
is deleted.</div>
</div>
</div>
<p><div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="../topics/cxmlsced.html" title="XML schemas are an XML language for describing and constraining the content of XML files.">XML schema editor</a></div>
</p>
<p class="reltasks"><strong>Related tasks</strong><br />
<div><a href="../topics/tedtschm.html" title="After you create an XML schema, you can edit its various properties, such as its namespace and prefix.">Editing XML schema properties</a></div>
</div>
</p></body>
</html>