blob: 350dee9032bca0f0c4a784ecc277dbf3d7b43e08 [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 complex types" />
12<meta name="abstract" content="A complex type allows elements in its content and can carry attributes. Complex types can be used to help determine the appropriate content for any instance documents generated from or associated with your XML schema." />
13<meta name="description" content="A complex type allows elements in its content and can carry attributes. Complex types can be used to help determine the appropriate content for any instance documents generated from or associated with your XML schema." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, complex types, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, complex types, XML schema files" name="keywords" />
kprice43d0c0f2006-05-18 15:56:09 +000016<meta scheme="URI" name="DC.Relation" content="../topics/taddcmod.html" />
kprice159fa582006-05-08 21:30:45 +000017<meta content="XHTML" name="DC.Format" />
18<meta content="taddcmxt" name="DC.Identifier" />
19<meta content="en-us" name="DC.Language" />
20<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
21<title>Adding complex types</title>
syeshin8f077832005-09-06 04:22:45 +000022</head>
kprice159fa582006-05-08 21:30:45 +000023<body id="taddcmxt"><a name="taddcmxt"><!-- --></a>
24
25
26<h1 class="topictitle1">Adding complex types</h1>
27
28
29
30
31<div><p>A complex type allows elements in its content and can carry attributes.
32Complex types can be used to help determine the appropriate content for any
33instance documents generated from or associated with your XML schema.</p>
34
35<div class="section"><p>You can add as many complex types as you want to an XML schema.</p>
36<p>The
37following instructions were written for the Resource perspective, but they
38will also work in many other perspectives.</p>
39<p>To add a complex type to
kpricede20a692008-04-24 00:27:47 +000040an XML schema, complete the following steps:</p>
kprice159fa582006-05-08 21:30:45 +000041</div>
42
43<ol>
44<li class="stepexpand"><span>Open your XML schema in the XML schema editor.</span></li>
45
kprice43d0c0f2006-05-18 15:56:09 +000046<li class="stepexpand"><span>Right-click the Types category in the Design view, and click <span class="uicontrol">Add
kprice159fa582006-05-08 21:30:45 +000047Complex Type</span>.</span></li>
48
49<li class="stepexpand"><span>In the Properties view, type a new name for the complex type in
50the <span class="uicontrol">Name</span> field.</span></li>
51
kpricede20a692008-04-24 00:27:47 +000052<li class="stepexpand"><span>Select <span class="uicontrol">Browse</span> in the <span class="uicontrol">Inherited
53From</span> drop down to select a base type for your complex type.</span>
kprice43d0c0f2006-05-18 15:56:09 +000054 You can either set a base type for your complex type, or you can add
55a content model to it (which represents any data that can be contained inside
56an element), but you cannot do both. For more information about content models,
kpricede20a692008-04-24 00:27:47 +000057see <a href="taddcmod.html">Adding content models</a>.
58</li>
kprice159fa582006-05-08 21:30:45 +000059
60<li class="stepexpand"><span>Select <span class="uicontrol">restriction</span> or <span class="uicontrol">extension</span> from
kpricede20a692008-04-24 00:27:47 +000061the <span class="uicontrol">Inherited By</span> list.</span> This specifies whether
kprice159fa582006-05-08 21:30:45 +000062your type is derived from its base type by restriction or extension.
63</li>
64
kprice43d0c0f2006-05-18 15:56:09 +000065<li class="stepexpand"><span>The Design view will display the attributes within the complex
66type.</span> You can also use this view to add attributes to your complex
67type. An attribute associates an attribute name with a specific type and value.
kpricede20a692008-04-24 00:27:47 +000068To add an attribute, in the Design view, right click your complex type and
69select <span class="uicontrol">Add Attribute</span>.<ul>
kprice43d0c0f2006-05-18 15:56:09 +000070<li><span class="uicontrol">name</span>. In the Design view, click the name of the
71attribute to make a change.</li>
kprice159fa582006-05-08 21:30:45 +000072
kprice43d0c0f2006-05-18 15:56:09 +000073<li><span class="uicontrol">type</span>. In the Design view, click the type of the
74attribute to make a change. The drop-down menu provides commonly used types.
75For more options, simply select <span class="uicontrol">Browse</span> from the menu.</li>
76
77</ul>
kpricede20a692008-04-24 00:27:47 +000078For information about adding attributes, attribute references, and <kbd class="userinput">any</kbd> attributes,
79see <a href="taddagrp.html">Adding attribute groups</a>.
kprice43d0c0f2006-05-18 15:56:09 +000080</li>
kprice159fa582006-05-08 21:30:45 +000081
kprice159fa582006-05-08 21:30:45 +000082<li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want
83to provide any information about this complex type.</span> The <span class="uicontrol">Documentation</span> page
kprice43d0c0f2006-05-18 15:56:09 +000084is used for human readable material, such as a description.</li>
85
86<li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to
87add application information elements to your annotations of schema components.</span>
88 The <span class="uicontrol">Extensions</span> page allows you to specify the
89schema and add XML content to your annotations.</li>
kprice159fa582006-05-08 21:30:45 +000090
91</ol>
92
93</div>
94
kprice43d0c0f2006-05-18 15:56:09 +000095<div><div class="reltasks"><strong>Related tasks</strong><br />
96<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>
97</div>
98</div>
kprice159fa582006-05-08 21:30:45 +000099
100</body>
101</html>