blob: a782053f9307b1a5274429223e13d0d3d5d30788 [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 import elements" />
12<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 an import element to bring in definitions and declarations from an imported schema into the current 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 an import element to bring in definitions and declarations from an imported schema into the current schema." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, import elements, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, import elements, XML schema files" name="keywords" />
kprice43d0c0f2006-05-18 15:56:09 +000016<meta scheme="URI" name="DC.Relation" content="../topics/taddincl.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="taddimpt" 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 import elements</title>
syeshin8f077832005-09-06 04:22:45 +000024</head>
kprice159fa582006-05-08 21:30:45 +000025<body id="taddimpt"><a name="taddimpt"><!-- --></a>
26
27
28<h1 class="topictitle1">Adding import 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 an <samp class="codeph">import</samp> element to
36bring in definitions and declarations from an imported schema into the current
37schema. </p>
38
39<div class="section"><p>The imported schema can come from a different namespace than the
kpricede20a692008-04-24 00:27:47 +000040current schema does. You can add multiple import elements to an XML schema,
41however, prefixes and namespaces have to unique amongst the imported schemas.</p>
42<p>The
43following instructions were written for the Resource perspective, but they
44will also work in many other perspectives.</p>
45<p>To add an import element,
46complete the following steps:</p>
kprice159fa582006-05-08 21:30:45 +000047</div>
48
49<ol>
kpricede20a692008-04-24 00:27:47 +000050<li class="stepexpand"><span>Open your XML schema in the XML schema editor. In the Outline view,
51select your schema.</span> The entire schema and its contents should be
52displayed in the Design view.</li>
kprice159fa582006-05-08 21:30:45 +000053
kprice43d0c0f2006-05-18 15:56:09 +000054<li class="stepexpand"><span>In the Design view, right click in the <strong>Directives</strong> section
kprice159fa582006-05-08 21:30:45 +000055and click <span class="uicontrol">Add Import</span>.</span></li>
56
kpricede20a692008-04-24 00:27:47 +000057<li class="stepexpand"><span>In the Properties view, click the <strong>General</strong> tab and click
58the <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
59location</span> field.</span></li>
kprice159fa582006-05-08 21:30:45 +000060
kprice43d0c0f2006-05-18 15:56:09 +000061<li class="stepexpand"><span>If you want to import an XML schema located in the workbench:</span>
kprice159fa582006-05-08 21:30:45 +000062<ol type="a">
kprice43d0c0f2006-05-18 15:56:09 +000063<li><span>Select <span class="uicontrol">Workbench projects</span> and click <span class="uicontrol">Next</span>. </span>
64</li>
65
kprice159fa582006-05-08 21:30:45 +000066<li><span>Select the schema you want to import and click <span class="uicontrol">Finish</span>.</span>
67</li>
68
69</ol>
70
71</li>
72
kprice43d0c0f2006-05-18 15:56:09 +000073<li class="stepexpand"><span>If you want to import an XML schema located on the Web:</span>
kprice159fa582006-05-08 21:30:45 +000074<ol type="a">
kprice43d0c0f2006-05-18 15:56:09 +000075<li class="substepexpand"><span>Select <span class="uicontrol">HTTP</span> and click <span class="uicontrol">Next</span>.</span>
76</li>
77
kprice159fa582006-05-08 21:30:45 +000078<li class="substepexpand"><span>Type the URL of the XML schema and click <span class="uicontrol">Finish</span>.</span>
kpriceebd54462006-05-15 22:15:20 +000079 <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 +000080Every time you validate your schema, the schema's contents will be checked
81from the URL you specify.</div>
82</li>
83
84</ol>
85
86</li>
87
88<li class="stepexpand"><span>The XML schema editor will retrieve the namespace for the imported
89XML schema file and display it as read-only in the <span class="uicontrol">Namespace</span> field.</span>
90</li>
91
92<li class="stepexpand"><span>If necessary, type a unique prefix for this namespace in the <span class="uicontrol">Prefix</span> field.</span>
93</li>
94
95<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
96to provide any information about this import element.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +000097is used for human readable material, such as a description.</li>
98
99<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
100add application information elements to your annotations of schema components.</span>
101 The <span class="uicontrol">Extensions</span> page allows you to specify the
102schema and add XML content to your annotations.</li>
kprice159fa582006-05-08 21:30:45 +0000103
104</ol>
105
106<div class="section"><p>Once you have added an import element to your XML schema, when
107you define new elements, attributes, complex types, or simple types where
108you can specify type information, any declarations from the included schema
109will be available in the <span class="uicontrol">Type</span> list for the element,
110attribute, complex or simple type.</p>
111</div>
112
113<div class="section" />
114
115</div>
116
kprice43d0c0f2006-05-18 15:56:09 +0000117<div><div class="reltasks"><strong>Related tasks</strong><br />
118<div><a href="../topics/taddincl.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 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.">Adding include elements</a></div>
119<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>
120</div>
121<div class="relref"><strong>Related reference</strong><br />
122<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>
123</div>
124</div>
kprice159fa582006-05-08 21:30:45 +0000125
126</body>
127</html>