blob: 7abba83f41a20178c5f9df72952206b68a672b97 [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 lang="en-us" xml:lang="en-us">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="Copyright (c) 2000, 2006 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" />
<meta name="DC.rights.owner" content="(C) Copyright 2000, 2006" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="task" name="DC.Type" />
<meta name="DC.Title" content="Adding include elements" />
<meta name="abstract" content="As schemas become larger, it is often desirable to divide their content among several schema documents for purposes such as ease of maintenance, reuse, and readability. You can use the include element to bring in definitions and declarations from the included schema into the current schema. The included schema must be in the same target namespace as the including schema." />
<meta name="description" content="As schemas become larger, it is often desirable to divide their content among several schema documents for purposes such as ease of maintenance, reuse, and readability. You can use the include element to bring in definitions and declarations from the included schema into the current schema. The included schema must be in the same target namespace as the including schema." />
<meta content="XML schema editor, adding, include elements, XML schema files, include elements, XML schema files" name="DC.subject" />
<meta content="XML schema editor, adding, include elements, XML schema files, include elements, XML schema files" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="../topics/taddimpt.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/taddrdfn.html" />
<meta scheme="URI" name="DC.Relation" content="../topics/rnmspc.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="taddincl" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
<title>Adding include elements</title>
</head>
<body id="taddincl"><a name="taddincl"><!-- --></a>
<h1 class="topictitle1">Adding include elements</h1>
<div><p>As schemas become larger, it is often desirable to divide their
content among several schema documents for purposes such as ease of maintenance,
reuse, and readability. You can use the <samp class="codeph">include</samp> element to
bring in definitions and declarations from the included schema
into the current schema. The included schema must be in the same target namespace
as the including schema. </p>
<div class="section"><p>The following instructions were written for the XML perspective,
but they will also work in many other perspectives.</p>
<p>To add an include
element, follow these steps:</p>
</div>
<ol>
<li class="stepexpand"><span>Open your XML schema in the XML schema editor.</span></li>
<li class="stepexpand"><span>In the Outline view, select your schema.</span> The entire
schema and its contents are displayed in the Design view.</li>
<li class="stepexpand"><span>In the Design view, right-click in the <strong>Directives</strong> section
and click <span class="uicontrol">Add Include</span>.</span></li>
<li class="stepexpand"><span>In the Properties view, click the <strong>General</strong> tab and click <span class="uicontrol">Browse</span> <img src="../images/Browse.gif" alt="This graphic is the Browse button" /> to
the right of the <span class="uicontrol">Schema location</span> field.</span> The
XML schema file you select must have the same namespace as the current schema.
</li>
<li class="stepexpand"><span>If you want to select an XML schema located in the workbench, select <span class="uicontrol">Workbench
projects</span> and click <span class="uicontrol">Next</span>. </span></li>
<li class="stepexpand"><span>Select the schema you want to include and click <span class="uicontrol">Finish</span>.</span>
</li>
<li class="stepexpand"><span>If you want to select an XML schema located on the Web, select <span class="uicontrol">HTTP</span> and
click <span class="uicontrol">Next</span>.</span></li>
<li class="stepexpand"><span>Type the URL of the XML schema and click <span class="uicontrol">Finish</span>.</span>
<div class="note"><span class="notetitle">Note:</span> A local copy of the schema will not be stored in the workbench.
Every time you validate your schema, the schema's contents will be checked
from the URL you specify.</div>
</li>
<li class="stepexpand"><span>The XML schema editor will retrieve the location of the included
XML schema file, and display it in the <span class="uicontrol">Schema location</span> field.
This field can be edited at any time to reflect the location of the XML schema
file.</span></li>
<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
to provide any information about this include element.</span> The <span class="uicontrol">Documentation</span> page
is used for human readable material, such as a description.</li>
<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
add application information elements to your annotations of schema components.</span>
The <span class="uicontrol">Extensions</span> page allows you to specify the
schema and add XML content to your annotations.</li>
</ol>
<div class="section"><p>Once you have added the include element to your XML schema, when
you define new elements, attributes, complex types, or simple types where
you can specify type information, any declarations from the included schema
will be available in the <span class="uicontrol">Type</span> list for the element,
attribute, complex or simple type.</p>
<p>For example, if Address.xsd has the
following content:</p>
<pre>&lt;complexType name="Address"&gt;
&lt;sequence&gt;
&lt;element name="name" type="string"&gt;
&lt;element name="street" type="string"&gt;
&lt;/sequence&gt;
&lt;/complexType&gt;
</pre>
and you have an XML schema called PurchaseOrder.xsd that has added
an include for Address.xsd, then when defining a new element in PurchaseOrder,
you can select Address as its type. <p>(c) Copyright 2001, World Wide Web
Consortium (Massachusetts Institute of Technology, Institut National de Recherche
en Informatique et en Automatique, Keio University).</p>
</div>
</div>
<div><div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="../topics/taddimpt.html" title="As schemas become larger, it is often desirable to divide their content among several schema documents for purposes such as ease of maintenance, reuse, and readability. You can use an import element to bring in definitions and declarations from an imported schema into the current schema.">Adding import elements</a></div>
<div><a href="../topics/taddrdfn.html" title="You can use the redefine mechanism to redefine simple and complex types, groups, and attribute groups obtained from external schema files. When you redefine a component, you are modifying its contents.">Adding redefine elements</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="../topics/rnmspc.html" title="An XML namespace is a collection of names, identified by a URI reference, which are used in XML documents as element types and attribute names.">XML namespaces</a></div>
</div>
</div>
</body>
</html>