blob: e32c564f2fd1c6a4540ee4145407da93ec060685 [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 elements" />
kprice43d0c0f2006-05-18 15:56:09 +000012<meta name="abstract" content="Elements are fundamental building blocks in XML. Element declarations provide value constraints, provide a description that can be used for validation, establish constraining relationships between related elements and attributes, and control the substitution of elements." />
13<meta name="description" content="Elements are fundamental building blocks in XML. Element declarations provide value constraints, provide a description that can be used for validation, establish constraining relationships between related elements and attributes, and control the substitution of elements." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, elements, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, 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" />
18<meta scheme="URI" name="DC.Relation" content="../topics/taddanye.html" />
19<meta scheme="URI" name="DC.Relation" content="../topics/taddglba.html" />
kprice159fa582006-05-08 21:30:45 +000020<meta content="XHTML" name="DC.Format" />
21<meta content="taddelm" name="DC.Identifier" />
22<meta content="en-us" name="DC.Language" />
23<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
syeshind0bdb8e2005-10-27 17:44:14 +000024<title>Adding elements</title>
syeshin8f077832005-09-06 04:22:45 +000025</head>
kprice159fa582006-05-08 21:30:45 +000026<body id="taddelm"><a name="taddelm"><!-- --></a>
27
28
29<h1 class="topictitle1">Adding elements</h1>
30
31
32
33
34<div><p>Elements are fundamental building blocks in XML. Element declarations
kprice43d0c0f2006-05-18 15:56:09 +000035provide value constraints, provide a description that can be used for validation,
36establish constraining relationships between related elements and attributes,
37and control the substitution of elements.</p>
kprice159fa582006-05-08 21:30:45 +000038
39<div class="section"><p>The following instructions were written for the Resource perspective,
40but they will also work in many other perspectives.</p>
kpricede20a692008-04-24 00:27:47 +000041<p>To add an element,
42complete the following steps:</p>
kprice159fa582006-05-08 21:30:45 +000043</div>
44
45<ol>
kprice43d0c0f2006-05-18 15:56:09 +000046<li class="stepexpand"><span>To add an element, in the Design view, right-click the content
kpricede20a692008-04-24 00:27:47 +000047model (sequence, choice, or all element) you want to work with and click <span class="uicontrol">Add
48Element</span>.</span> The element appears attached to the content
49model in the Design view.
kprice159fa582006-05-08 21:30:45 +000050<ol type="a">
kprice43d0c0f2006-05-18 15:56:09 +000051<li class="substepexpand"><span>In the Design view, select the element, and click the current
kprice159fa582006-05-08 21:30:45 +000052(default) name of the element, which puts you in direct editing mode, then
kprice43d0c0f2006-05-18 15:56:09 +000053type the new <span class="uicontrol">Name</span> and press enter.</span></li>
kprice159fa582006-05-08 21:30:45 +000054
kprice43d0c0f2006-05-18 15:56:09 +000055<li class="substepexpand"><span>In the Design view, click the current (default) element type
kprice159fa582006-05-08 21:30:45 +000056and select a type from the menu. Alternately, you can select browse to invoke
57the Set Type dialog for more options.</span> The Set Type dialog lists
58all built-in and user-defined types currently available. You can change the <span class="uicontrol">Scope</span> of
59the list by selecting one of the following options:<ul>
kpricede20a692008-04-24 00:27:47 +000060<li><span class="uicontrol">Workspace</span>: lists all of the types available in
kprice4873f982007-04-05 03:39:40 +000061your workspace.</li>
kprice159fa582006-05-08 21:30:45 +000062
kpricede20a692008-04-24 00:27:47 +000063<li><span class="uicontrol">Enclosing Project</span>: lists all of the types available
kprice4873f982007-04-05 03:39:40 +000064in the project that contains your file.</li>
kprice159fa582006-05-08 21:30:45 +000065
kpricede20a692008-04-24 00:27:47 +000066<li>(Default) <span class="uicontrol">Current Resource</span>: list all of the types
kprice159fa582006-05-08 21:30:45 +000067available in your current file.</li>
68
kpricede20a692008-04-24 00:27:47 +000069<li><span class="uicontrol">Working Sets</span>: list all the types available within
kprice159fa582006-05-08 21:30:45 +000070the selected working set.</li>
71
72</ul>
73</li>
74
75</ol>
76
77</li>
78
79<li class="stepexpand"><span>(Optional) In the Properties view, select the appropriate value
kpricede20a692008-04-24 00:27:47 +000080in the <span class="uicontrol">Minimum Occurrence</span> field.</span> This is
81the number of times the element can appear in an instance document. If you
82want the element to be optional, select <span class="uicontrol">0</span>. Otherwise,
83select <span class="uicontrol">1</span>. </li>
kprice159fa582006-05-08 21:30:45 +000084
kpricede20a692008-04-24 00:27:47 +000085<li class="stepexpand"><span>(Optional) Select the appropriate value in the <span class="uicontrol">Maximum
86Occurrence</span> field.</span> This is the maximum
87number of times the element can appear in an instance document. Select <span class="uicontrol">unbounded</span> to
88indicate there is no maximum number of occurrences.</li>
kprice159fa582006-05-08 21:30:45 +000089
90<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
91to provide any information about this element.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +000092is used for human readable material, such as a description.</li>
93
94<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
95add application information elements to your annotations of schema components.</span>
96 The <span class="uicontrol">Extensions</span> page allows you to specify the
97schema and add XML content to your annotations.</li>
kprice159fa582006-05-08 21:30:45 +000098
99</ol>
100
101<div class="section">You can add a content model to an element, which is the representation
102of any data that can be contained inside the element. For more information
103about working with content models, refer to the related tasks.</div>
104
105</div>
106
kprice43d0c0f2006-05-18 15:56:09 +0000107<div><div class="reltasks"><strong>Related tasks</strong><br />
108<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>
109<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>
110<div><a href="../topics/taddanye.html" title="You can use the any element in a similar way as a DTD's ANY content model, however, it must be done in conjunction with namespaces. This enables you to include any well-formed XML content, such as an HTML Web page that conforms to XHTML 1.0 syntax.">Adding an any element</a></div>
111<div><a href="../topics/taddglba.html" title="A global attribute is an attribute that can be recognized anywhere in a document. Once declared, a global attribute can be referenced in one or more declarations using an attribute reference.">Adding global attributes</a></div>
112</div>
113</div>
kprice159fa582006-05-08 21:30:45 +0000114
115</body>
116</html>