blob: 6343b7e3bda0e7a31619f129a48d7faffab8bc28 [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 attribute groups" />
12<meta name="abstract" content="An attribute group definition is an association between a name and a set of attribute declarations. Named groups of attribute declarations can greatly facilitate the maintenance and reuse of common attribute declarations in an XML schema." />
13<meta name="description" content="An attribute group definition is an association between a name and a set of attribute declarations. Named groups of attribute declarations can greatly facilitate the maintenance and reuse of common attribute declarations in an XML schema." />
kpricede20a692008-04-24 00:27:47 +000014<meta content="XML schema editor, attribute groups, XML schema files" name="DC.subject" />
15<meta content="XML schema editor, attribute groups, XML schema files" name="keywords" />
kprice159fa582006-05-08 21:30:45 +000016<meta content="XHTML" name="DC.Format" />
17<meta content="taddagrp" name="DC.Identifier" />
18<meta content="en-us" name="DC.Language" />
19<link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" />
syeshind0bdb8e2005-10-27 17:44:14 +000020<title>Adding attribute groups</title>
syeshin8f077832005-09-06 04:22:45 +000021</head>
syeshinf3d0d4b2005-07-27 18:33:03 +000022<body id="taddagrp"><a name="taddagrp"><!-- --></a>
23
kprice159fa582006-05-08 21:30:45 +000024
syeshind0bdb8e2005-10-27 17:44:14 +000025<h1 class="topictitle1">Adding attribute groups</h1>
kprice159fa582006-05-08 21:30:45 +000026
27
28
29
syeshinf3d0d4b2005-07-27 18:33:03 +000030<div><p>An attribute group definition is an association between a name
syeshind0bdb8e2005-10-27 17:44:14 +000031and a set of attribute declarations. Named groups of attribute declarations
32can greatly facilitate the maintenance and reuse of common attribute declarations
33in an XML schema.</p>
kprice159fa582006-05-08 21:30:45 +000034
syeshind0bdb8e2005-10-27 17:44:14 +000035<div class="section"><p>The following instructions were written for the Resource perspective,
36but they will also work in many other perspectives.</p>
kprice159fa582006-05-08 21:30:45 +000037<p>To add an attribute
kpricede20a692008-04-24 00:27:47 +000038group to an XML schema, complete the following steps:</p>
syeshinf3d0d4b2005-07-27 18:33:03 +000039</div>
kprice159fa582006-05-08 21:30:45 +000040
41<ol>
42<li class="stepexpand"><span>Open your XML schema in the XML schema editor.</span></li>
43
kpricede20a692008-04-24 00:27:47 +000044<li class="stepexpand"><span>In the Outline view, right-click the <span class="uicontrol">Attributes</span> folder
kprice159fa582006-05-08 21:30:45 +000045and click <span class="uicontrol">Add Attribute Group</span>.</span> It appears
kpricede20a692008-04-24 00:27:47 +000046in the <span class="uicontrol">Attributes</span> folder.</li>
kprice159fa582006-05-08 21:30:45 +000047
kprice43d0c0f2006-05-18 15:56:09 +000048<li class="stepexpand"><span>Select your new group, and in the Design view, right-click the
49attribute group and select <span class="menucascade"><span class="uicontrol">Refactor</span> &gt; <span class="uicontrol">Rename</span>
kprice159fa582006-05-08 21:30:45 +000050</span>. In the <span class="uicontrol">New Name</span> field, type a name
kpricede20a692008-04-24 00:27:47 +000051for the attribute group and click <span class="uicontrol">OK</span>.</span></li>
kprice159fa582006-05-08 21:30:45 +000052
53<li class="stepexpand"><span>To add an attribute, right-click your attribute group in the Outline
54view, click <span class="uicontrol">Add Attribute</span>.</span> The attribute
55appears below the attribute group in the Outline view.
56<ol type="a">
kprice43d0c0f2006-05-18 15:56:09 +000057<li class="substepexpand"><span>Select the attribute, and in the Design view, click the current
kprice159fa582006-05-08 21:30:45 +000058(default) name of the attribute, then type the new <span class="uicontrol">Name</span>.</span>
59</li>
60
kprice43d0c0f2006-05-18 15:56:09 +000061<li class="substepexpand"><span>In the Design view, click the current (default) attribute type
kprice159fa582006-05-08 21:30:45 +000062and select a type from the menu. Alternately, you can select browse to invoke
63the Set Type menu for more options.</span> The Set Type dialog lists all
64built-in and user-defined types currently available. You can change the <span class="uicontrol">Scope</span> of
65the list by selecting one of the following options:<ul>
66<li><span class="uicontrol">Workspace</span>. Lists all of the types available in
67your workspace. </li>
68
69<li><span class="uicontrol">Enclosing Project</span>. Lists all of the types available
70in the project that contains your file. </li>
71
kpricede20a692008-04-24 00:27:47 +000072<li><span class="uicontrol">Current Resource</span> (default). List all of the types
kprice159fa582006-05-08 21:30:45 +000073available in your current file.</li>
74
75<li><span class="uicontrol">Working Sets</span>. List all the types available within
76the selected working set.</li>
77
78</ul>
79</li>
80
81</ol>
82
83</li>
84
85<li class="stepexpand"><span>An attribute reference provides a reference to a global attribute.
kprice43d0c0f2006-05-18 15:56:09 +000086To add an attribute reference, in the Design view, right-click the complex
kprice159fa582006-05-08 21:30:45 +000087type containing the element, and click <span class="uicontrol">Add Attribute Ref</span>.</span>
88 A declaration that references a global attribute enables the referenced
89attribute to appear in the instance document in the context of the referencing
kpricede20a692008-04-24 00:27:47 +000090declaration. Select the reference, then in the Properties view, select the
91attribute you want it to reference from the<span class="uicontrol">Reference</span> drop-down
kprice159fa582006-05-08 21:30:45 +000092</li>
93
94<li class="stepexpand"><span>An attribute group reference provides a reference to an attribute
kprice43d0c0f2006-05-18 15:56:09 +000095group. To add an attribute group reference, in the Design view, right-click
kprice159fa582006-05-08 21:30:45 +000096the complex type containing the element, and click <span class="uicontrol">Add Attribute
97Group Ref</span>.</span> A declaration that references a global attribute
98enables the referenced attribute to appear in the instance document in the
kpricede20a692008-04-24 00:27:47 +000099context of the referencing declaration. Select the reference, then in the
100Properties view, select the attribute group you want it to reference from
101the<span class="uicontrol">Reference</span> drop-down.</li>
kprice159fa582006-05-08 21:30:45 +0000102
103<li class="stepexpand"><span>An <samp class="codeph">any</samp> element enables element content according
104to namespaces, and the corresponding <samp class="codeph">any</samp> attribute element
105enables attributes to appear in elements. To add an <samp class="codeph">any</samp> attribute,
106right-click your attribute group and click <span class="uicontrol">Add Any Attribute</span>.</span>
107 The <samp class="codeph">any</samp> appears below the attribute group in the Outline
108view. You can specify the following values for an <samp class="codeph">any</samp> attribute:
syeshind0bdb8e2005-10-27 17:44:14 +0000109<ul>
kpricede20a692008-04-24 00:27:47 +0000110<li>For a <span class="uicontrol">namespace</span> value, you can select:<ul>
111<li><strong>##any</strong>: this allows any well-formed XML from any namespace.</li>
kprice159fa582006-05-08 21:30:45 +0000112
kpricede20a692008-04-24 00:27:47 +0000113<li><strong>##local </strong>: this allows any well-formed XML that is not declared
kprice43d0c0f2006-05-18 15:56:09 +0000114to be in a namespace.</li>
115
kpricede20a692008-04-24 00:27:47 +0000116<li><strong>##other</strong>: this allows any well-formed XML that is not from the target
kprice43d0c0f2006-05-18 15:56:09 +0000117namespace of the type being defined.</li>
118
kpricede20a692008-04-24 00:27:47 +0000119<li><strong>##targetNamespace </strong>: this is shorthand for the target namespace
kprice43d0c0f2006-05-18 15:56:09 +0000120of the type being defined.</li>
121
122</ul>
123</li>
124
125<li>For a <span class="uicontrol">processContents</span> value, you can select:<ul>
kpricede20a692008-04-24 00:27:47 +0000126<li><strong>skip</strong>: the XML processor will not validate the attribute
127content at all.</li>
kprice43d0c0f2006-05-18 15:56:09 +0000128
kpricede20a692008-04-24 00:27:47 +0000129<li><strong>lax</strong>: the XML processor will validate the attribute content as much
kprice43d0c0f2006-05-18 15:56:09 +0000130as it can.</li>
131
kpricede20a692008-04-24 00:27:47 +0000132<li><strong>strict</strong>: the XML processor will validate all the attribute content.</li>
kprice43d0c0f2006-05-18 15:56:09 +0000133
134</ul>
135</li>
kprice159fa582006-05-08 21:30:45 +0000136
syeshinf3d0d4b2005-07-27 18:33:03 +0000137</ul>
kprice159fa582006-05-08 21:30:45 +0000138
139</li>
140
syeshinf3d0d4b2005-07-27 18:33:03 +0000141</ol>
kprice159fa582006-05-08 21:30:45 +0000142
syeshinf3d0d4b2005-07-27 18:33:03 +0000143</div>
kprice159fa582006-05-08 21:30:45 +0000144
145
syeshinf3d0d4b2005-07-27 18:33:03 +0000146</body>
147</html>