blob: 03479624d312c26343ea77f296380ce3f40a8b7b [file] [log] [blame]
kprice159fa582006-05-08 21:30:45 +00001<?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">
2<html lang="en-us" xml:lang="en-us">
syeshinf3d0d4b2005-07-27 18:33:03 +00003<head>
kprice159fa582006-05-08 21:30:45 +00004<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
kpricede20a692008-04-24 00:27:47 +00005<meta name="copyright" content="Copyright (c) 2000, 2008 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" />
6<meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" />
kprice159fa582006-05-08 21:30:45 +00007<meta content="public" name="security" />
8<meta content="index,follow" name="Robots" />
9<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))' />
10<meta content="task" name="DC.Type" />
11<meta name="DC.Title" content="Adding include elements" />
kprice43d0c0f2006-05-18 15:56:09 +000012<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." />
13<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." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, include elements, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, include elements, XML schema files" name="keywords" />
kprice43d0c0f2006-05-18 15:56:09 +000016<meta scheme="URI" name="DC.Relation" content="../topics/taddimpt.html" />
17<meta scheme="URI" name="DC.Relation" content="../topics/taddrdfn.html" />
18<meta scheme="URI" name="DC.Relation" content="../topics/rnmspc.html" />
kprice159fa582006-05-08 21:30:45 +000019<meta content="XHTML" name="DC.Format" />
20<meta content="taddincl" name="DC.Identifier" />
21<meta content="en-us" name="DC.Language" />
22<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
syeshind0bdb8e2005-10-27 17:44:14 +000023<title>Adding include elements</title>
syeshin8f077832005-09-06 04:22:45 +000024</head>
kprice159fa582006-05-08 21:30:45 +000025<body id="taddincl"><a name="taddincl"><!-- --></a>
26
27
28<h1 class="topictitle1">Adding include elements</h1>
29
30
31
32
33<div><p>As schemas become larger, it is often desirable to divide their
34content among several schema documents for purposes such as ease of maintenance,
35reuse, and readability. You can use the <samp class="codeph">include</samp> element to
kpricede20a692008-04-24 00:27:47 +000036bring in definitions and declarations from the included schema into the current
37schema. The included schema must be in the same target namespace as the including
38schema. </p>
kprice159fa582006-05-08 21:30:45 +000039
40<div class="section"><p>The following instructions were written for the XML perspective,
41but they will also work in many other perspectives.</p>
42<p>To add an include
kpricede20a692008-04-24 00:27:47 +000043element, complete the following steps:</p>
kprice159fa582006-05-08 21:30:45 +000044</div>
45
46<ol>
kpricede20a692008-04-24 00:27:47 +000047<li class="stepexpand"><span>Open your XML schema in the XML schema editor. In the Outline view,
48select your schema.</span> The entire schema and its contents are displayed
49in the Design view.</li>
kprice159fa582006-05-08 21:30:45 +000050
kprice43d0c0f2006-05-18 15:56:09 +000051<li class="stepexpand"><span>In the Design view, right-click in the <strong>Directives</strong> section
kprice159fa582006-05-08 21:30:45 +000052and click <span class="uicontrol">Add Include</span>.</span></li>
53
kpricede20a692008-04-24 00:27:47 +000054<li class="stepexpand"><span>In the Properties view, click the <strong>General</strong> tab and click
55the <span class="uicontrol">Browse</span> <img src="../images/Browse.gif" alt="This&#10;graphic is the Browse button" /> button to the right of the <span class="uicontrol">Schema
56location</span> field.</span> The XML schema file you select must
57have the same namespace as the current schema.</li>
58
59<li class="stepexpand"><span>If you want to import an XML schema located in the workbench:</span>
60<ol type="a">
61<li><span>Select <span class="uicontrol">Workbench projects</span> and click <span class="uicontrol">Next</span>. </span>
kprice159fa582006-05-08 21:30:45 +000062</li>
63
kpricede20a692008-04-24 00:27:47 +000064<li><span>Select the schema you want to import and click <span class="uicontrol">Finish</span>.</span>
kprice159fa582006-05-08 21:30:45 +000065</li>
66
kpricede20a692008-04-24 00:27:47 +000067</ol>
kprice159fa582006-05-08 21:30:45 +000068
kpricede20a692008-04-24 00:27:47 +000069</li>
70
71<li class="stepexpand"><span>If you want to import an XML schema located on the Web:</span>
72<ol type="a">
73<li class="substepexpand"><span>Select <span class="uicontrol">HTTP</span> and click <span class="uicontrol">Next</span>.</span>
74</li>
75
76<li class="substepexpand"><span>Type the URL of the XML schema and click <span class="uicontrol">Finish</span>.</span>
77 <div class="note"><span class="notetitle">Note:</span> A local copy of the schema will not be stored in the workbench.
kprice159fa582006-05-08 21:30:45 +000078Every time you validate your schema, the schema's contents will be checked
79from the URL you specify.</div>
80</li>
81
kpricede20a692008-04-24 00:27:47 +000082</ol>
83
84</li>
85
kprice159fa582006-05-08 21:30:45 +000086<li class="stepexpand"><span>The XML schema editor will retrieve the location of the included
87XML schema file, and display it in the <span class="uicontrol">Schema location</span> field.
88This field can be edited at any time to reflect the location of the XML schema
89file.</span></li>
90
91<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
92to provide any information about this include element.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +000093is used for human readable material, such as a description.</li>
94
95<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
96add application information elements to your annotations of schema components.</span>
97 The <span class="uicontrol">Extensions</span> page allows you to specify the
98schema and add XML content to your annotations.</li>
kprice159fa582006-05-08 21:30:45 +000099
100</ol>
101
102<div class="section"><p>Once you have added the include element to your XML schema, when
103you define new elements, attributes, complex types, or simple types where
104you can specify type information, any declarations from the included schema
105will be available in the <span class="uicontrol">Type</span> list for the element,
106attribute, complex or simple type.</p>
107<p>For example, if Address.xsd has the
108following content:</p>
109<pre>&lt;complexType name="Address"&gt;
syeshinf3d0d4b2005-07-27 18:33:03 +0000110 &lt;sequence&gt;
111 &lt;element name="name" type="string"&gt;
112 &lt;element name="street" type="string"&gt;
113 &lt;/sequence&gt;
kprice159fa582006-05-08 21:30:45 +0000114&lt;/complexType&gt;
115</pre>
116and you have an XML schema called PurchaseOrder.xsd that has added
117an include for Address.xsd, then when defining a new element in PurchaseOrder,
kpricede20a692008-04-24 00:27:47 +0000118you can select Address as its type. </div>
kprice159fa582006-05-08 21:30:45 +0000119
120</div>
121
kprice43d0c0f2006-05-18 15:56:09 +0000122<div><div class="reltasks"><strong>Related tasks</strong><br />
123<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>
124<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>
125</div>
126<div class="relref"><strong>Related reference</strong><br />
127<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>
128</div>
129</div>
kprice159fa582006-05-08 21:30:45 +0000130
131</body>
132</html>