blob: 20fd9484eb87ab3376e467bfd33fee4e1454cb80 [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" "">
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 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 "" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "" l gen true r (n 0 s 0 v 0 l 0) "" l gen true r (SS~~000 1))' />
10<meta content="task" name="DC.Type" />
11<meta name="DC.Title" content="Adding global elements" />
12<meta name="abstract" content="A global element is an element with a global scope. It is one that has been declared as part of the main schema rather than as part of a content model." />
13<meta name="description" content="A global element is an element with a global scope. It is one that has been declared as part of the main schema rather than as part of a content model." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, global elements, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, global elements, XML schema files" name="keywords" />
kprice43d0c0f2006-05-18 15:56:09 +000016<meta scheme="URI" name="DC.Relation" content="../topics/taddcmod.html" />
17<meta scheme="URI" name="DC.Relation" content="../topics/taddelmr.html" />
kprice159fa582006-05-08 21:30:45 +000018<meta content="XHTML" name="DC.Format" />
19<meta content="taddglem" name="DC.Identifier" />
20<meta content="en-us" name="DC.Language" />
21<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
22<title>Adding global elements</title>
syeshin8f077832005-09-06 04:22:45 +000023</head>
kprice159fa582006-05-08 21:30:45 +000024<body id="taddglem"><a name="taddglem"><!-- --></a>
27<h1 class="topictitle1">Adding global elements</h1>
32<div><p>A global element is an element with a global scope. It is one that
33has been declared as part of the main schema rather than as part of a content
36<div class="section"><p>The following instructions were written for the Resource perspective,
37but they will also work in many other perspectives.</p>
38<p>To add a global
kpricede20a692008-04-24 00:27:47 +000039element, complete the following steps:</p>
kprice159fa582006-05-08 21:30:45 +000040</div>
43<li class="stepexpand"><span>Open your XML schema in the XML schema editor.</span></li>
45<li class="stepexpand"><span>In the Outline view, select your schema.</span> The entire
kprice43d0c0f2006-05-18 15:56:09 +000046schema and its contents are displayed in the Design view.</li>
kprice159fa582006-05-08 21:30:45 +000047
kprice43d0c0f2006-05-18 15:56:09 +000048<li class="stepexpand"><span>In the Design view, right-click in the <strong>Elements</strong> section
49and click <span class="uicontrol">Add Element</span>.</span></li>
kprice159fa582006-05-08 21:30:45 +000050
51<li class="stepexpand"><span>In the Properties view, click the <span class="uicontrol">General</span> tab,
52and type a new name for the global element in the <span class="uicontrol">Name</span> field.</span>
kprice43d0c0f2006-05-18 15:56:09 +000055<li class="stepexpand"><span>In the Properties view, you can select the attribute type from
kprice159fa582006-05-08 21:30:45 +000056the predefined list in the menu next to the <span class="uicontrol">Type</span> field.</span>
kprice43d0c0f2006-05-18 15:56:09 +000057 <p>Alternatively, you can select <span class="uicontrol">Browse</span> from
58the list for more options. </p>
59<div class="p">The <span class="uicontrol">Set Type</span> dialog
60box appears, and lists all built-in and user-defined types currently available.
61You can change the <span class="uicontrol">Scope</span> of the list by selecting one
62of the following options:<ul>
kpricede20a692008-04-24 00:27:47 +000063<li><span class="uicontrol">Workspace</span>: lists all of the types available in
kprice159fa582006-05-08 21:30:45 +000064your workspace. </li>
kpricede20a692008-04-24 00:27:47 +000066<li><span class="uicontrol">Enclosing Project</span>: lists all of the types available
kprice159fa582006-05-08 21:30:45 +000067in the project that contains your file. </li>
kpricede20a692008-04-24 00:27:47 +000069<li>(Default) <span class="uicontrol">Current Resource</span>: list all of the types
kprice159fa582006-05-08 21:30:45 +000070available in your current file.</li>
kpricede20a692008-04-24 00:27:47 +000072<li><span class="uicontrol">Working Sets</span>: list all the types available within
kprice159fa582006-05-08 21:30:45 +000073the selected working set.</li>
77<p>Select the type you want in the type list, then click <span class="uicontrol">OK</span>. </p>
kpricede20a692008-04-24 00:27:47 +000081<li class="stepexpand"><span>Click the <span class="uicontrol">Advanced</span> tab.</span> In this
82page, you can specify the following various values for the global element:
kprice159fa582006-05-08 21:30:45 +000083<ul>
kpricede20a692008-04-24 00:27:47 +000084<li><span class="uicontrol">Abstract</span>: click <strong>true</strong> if you want the
kprice159fa582006-05-08 21:30:45 +000085global element to be abstract. When a global element is declared to be abstract,
86it cannot be used in an instance document. Instead, a member of that global
87element's substitution group must appear in the instance document.</li>
kpricede20a692008-04-24 00:27:47 +000089<li><span class="uicontrol">Block</span>: determines whether the global element
90may be replaced by an element derived from it.</li>
kprice159fa582006-05-08 21:30:45 +000091
kpricede20a692008-04-24 00:27:47 +000092<li><span class="uicontrol">Final</span>: determines whether this global element
93may be derived from.</li>
kprice159fa582006-05-08 21:30:45 +000094
kpricede20a692008-04-24 00:27:47 +000095<li><span class="uicontrol">Substitution Group</span>: a substitution group allows
kprice159fa582006-05-08 21:30:45 +000096elements to be substituted for other elements.</li>
kpricede20a692008-04-24 00:27:47 +000098<li><span class="uicontrol">Nillable</span>: select <strong>true</strong> if you do not
99want the global element to be able to have any child elements, only attributes. </li>
kprice159fa582006-05-08 21:30:45 +0000100
kpricede20a692008-04-24 00:27:47 +0000105<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab to provide any
106information about this global element.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +0000107is used for human readable material, such as a description.</li>
kpricede20a692008-04-24 00:27:47 +0000109<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab to add application
110information elements to your annotations of schema components.</span> The <span class="uicontrol">Extensions</span> page
111allows you to specify the schema and add XML content to your annotations.
kprice159fa582006-05-08 21:30:45 +0000113
116<div class="section">You can add a content model to a global element, which is the representation
117of any data that can be contained inside the global element. For more information
118about working with content models, refer to the related tasks.</div>
kprice43d0c0f2006-05-18 15:56:09 +0000122<div><div class="reltasks"><strong>Related tasks</strong><br />
123<div><a href="../topics/taddcmod.html" title="A content model is the representation of any data that can be contained inside an element, global element, complex type, or group. It is a formal description of the structure and permissible content of an element, global element, complex type, or group, which may be used to validate a document instance.">Adding content models</a></div>
124<div><a href="../topics/taddelmr.html" title="An element reference provides a reference to a global element. A declaration that references a global element enables the referenced global element to appear in the instance document in the context of the referencing declaration.">Adding element references</a></div>
kprice159fa582006-05-08 21:30:45 +0000127