blob: a9b3cb7841f7216f3f5c1840957dc7ee587101b9 [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" />
5<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" />
6<meta name="DC.rights.owner" content="(C) Copyright 2000, 2006" />
7<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." />
kprice159fa582006-05-08 21:30:45 +000014<meta content="XML schema editor, adding, elements, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, adding, 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>
kprice43d0c0f2006-05-18 15:56:09 +000041<p>To add an element:</p>
kprice159fa582006-05-08 21:30:45 +000042</div>
43
44<ol>
kprice43d0c0f2006-05-18 15:56:09 +000045<li class="stepexpand"><span>To add an element, in the Design view, right-click the content
46model you want to work with and click <span class="uicontrol">Add Element</span>.</span>
47 The element appears attached to the content model in the Design view.
kprice159fa582006-05-08 21:30:45 +000048<ol type="a">
kprice43d0c0f2006-05-18 15:56:09 +000049<li class="substepexpand"><span>In the Design view, select the element, and click the current
kprice159fa582006-05-08 21:30:45 +000050(default) name of the element, which puts you in direct editing mode, then
kprice43d0c0f2006-05-18 15:56:09 +000051type the new <span class="uicontrol">Name</span> and press enter.</span></li>
kprice159fa582006-05-08 21:30:45 +000052
kprice43d0c0f2006-05-18 15:56:09 +000053<li class="substepexpand"><span>In the Design view, click the current (default) element type
kprice159fa582006-05-08 21:30:45 +000054and select a type from the menu. Alternately, you can select browse to invoke
55the Set Type dialog for more options.</span> The Set Type dialog lists
56all built-in and user-defined types currently available. You can change the <span class="uicontrol">Scope</span> of
57the list by selecting one of the following options:<ul>
58<li><span class="uicontrol">Workspace</span>. Lists all of the types available in
kprice4873f982007-04-05 03:39:40 +000059your workspace.</li>
kprice159fa582006-05-08 21:30:45 +000060
61<li><span class="uicontrol">Enclosing Project</span>. Lists all of the types available
kprice4873f982007-04-05 03:39:40 +000062in the project that contains your file.</li>
kprice159fa582006-05-08 21:30:45 +000063
64<li>(Default) <span class="uicontrol">Current Resource</span>. List all of the types
65available in your current file.</li>
66
67<li><span class="uicontrol">Working Sets</span>. List all the types available within
68the selected working set.</li>
69
70</ul>
71</li>
72
73</ol>
74
75</li>
76
77<li class="stepexpand"><span>(Optional) In the Properties view, select the appropriate value
kprice43d0c0f2006-05-18 15:56:09 +000078in the <span class="uicontrol">MinOccurs</span> field.</span> This is the number
79of times the element can appear in an instance document. If you want the element
80to be optional, select <span class="uicontrol">0</span>. Otherwise, select <span class="uicontrol">1</span>.
kprice159fa582006-05-08 21:30:45 +000081</li>
82
83<li class="stepexpand"><span>(Optional) Select the appropriate value in the <span class="uicontrol">MaxOccurs</span> field.</span>
84 This is the maximum number of times the element can appear in an instance
kprice43d0c0f2006-05-18 15:56:09 +000085document. Select <span class="uicontrol">unbounded</span> to indicate there is no
86maximum number of occurrences.</li>
kprice159fa582006-05-08 21:30:45 +000087
88<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
89to provide any information about this element.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +000090is used for human readable material, such as a description.</li>
91
92<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
93add application information elements to your annotations of schema components.</span>
94 The <span class="uicontrol">Extensions</span> page allows you to specify the
95schema and add XML content to your annotations.</li>
kprice159fa582006-05-08 21:30:45 +000096
97</ol>
98
99<div class="section">You can add a content model to an element, which is the representation
100of any data that can be contained inside the element. For more information
101about working with content models, refer to the related tasks.</div>
102
103</div>
104
kprice43d0c0f2006-05-18 15:56:09 +0000105<div><div class="reltasks"><strong>Related tasks</strong><br />
106<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>
107<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>
108<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>
109<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>
110</div>
111</div>
kprice159fa582006-05-08 21:30:45 +0000112
113</body>
114</html>