| <?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"> |
| <html> |
| <head> |
| <!-- /******************************************************************************* |
| * Copyright (c) 2000, 2005 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 |
| *******************************************************************************/ --> |
| <link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" /> |
| <title>Adding an attribute group</title> |
| </head> |
| <body id="taddagrp"><a name="taddagrp"><!-- --></a> |
| |
| <h1 class="topictitle1">Adding an attribute group</h1> |
| <div><p>An attribute group definition is an association between a name |
| and a set of attribute declarations, enabling re-use of the same set in several |
| complex type definitions. Named groups of attribute declarations can greatly |
| facilitate the maintenance and reuse of common attribute declarations in an |
| XML schema.</p><div class="skipspace"><p>The following instructions were written for the Resource perspective, |
| but they will also work in many other perspectives. </p> |
| <p>To add an |
| attribute group to an XML schema, follow these steps:</p> |
| </div> |
| <ol><li class="skipspace"><span>Open your XML schema in the XML schema editor.</span></li> |
| <li class="skipspace"><span>In the Outline view, right-click the XML schema and click <span class="uicontrol">Add |
| Attribute Group</span>.</span> It appears in the <span class="uicontrol">Attribute |
| Groups</span> folder.</li> |
| <li class="skipspace"><span>Select your new group, and in the Properties view, type a name |
| for the attribute group in the <span class="uicontrol">Name</span> field.</span></li> |
| <li class="skipspace"><span>To add an attribute, right-click your attribute group in the Outline |
| view, click <span class="uicontrol">Add Attribute</span>.</span> The attribute |
| appears below the attribute group in the Outline view.<ol type="a"><li class="skipspace"><span>Select the attribute, and in the Properties view, type the <span class="uicontrol">Name</span> of |
| it. </span></li> |
| <li class="skipspace"><span>Click the <span class="uicontrol">More</span> button and specify the |
| type for the attribute.</span> To specify that an attribute's type is |
| anonymous, when the <span class="uicontrol">User-defined simple type</span> radio |
| button is selected, click <span class="uicontrol">**anonymous**</span> in the type |
| list. The anonymous type is added to the outline under the attribute. |
| Expand the attribute to see it. You can then start adding content to the new |
| anonymous type.</li> |
| </ol> |
| </li> |
| <li class="skipspace"><span>An attribute reference provides a reference to a global attribute. |
| To add an attribute reference, right-click your attribute group, and click <span class="uicontrol">Add |
| Attribute Ref</span>.</span> A declaration that references a global |
| attribute enables the referenced attribute to appear in the instance document |
| in the context of the referencing declaration. The menu option to add |
| an attribute reference only appears if there are global attributes defined |
| elsewhere in the document.<ol type="a"><li><span>Select the reference (which appears below the attribute group |
| in the Outline view), then select the global attribute you want it to reference |
| from the <span class="uicontrol">ref</span> drop down list.</span></li> |
| </ol> |
| </li> |
| <li class="skipspace"><span>An attribute group reference provides a reference to an attribute |
| group. To add an attribute group reference, right-click your attribute group, |
| and click <span class="uicontrol">Add Attribute Group Ref</span>, and fill in the |
| field values as necessary.</span> A declaration that references an attribute |
| group enables the referenced attribute group to appear in the instance document |
| in the context of the referencing declaration. The menu option to add an attribute |
| group reference only appears if there are attribute groups defined elsewhere |
| in the document.<ol type="a"><li><span>Select the reference (which appears below the attribute group |
| in the Outline view), then select the attribute group you want it to reference |
| from the <span class="uicontrol">ref</span> drop down list.</span></li> |
| </ol> |
| </li> |
| <li class="skipspace"><span>An <samp class="codeph">any</samp> element enables attributes to appear |
| in <samp class="codeph">any</samp> elements. To add an <samp class="codeph">any</samp> attribute, |
| right-click in your attribute group and click <span class="uicontrol">Add Any Attribute</span>.</span> The <samp class="codeph">any</samp> appears below the attribute group in the Outline |
| view. You can specify the following values for an <samp class="codeph">any</samp> attribute:<ul><li>For a <b>namespace</b> value, you can select <b>##any</b> (this allows |
| any well-formed XML from any namespace), <b>##local </b> (this allows any |
| well-formed XML that is not declared to be in a namespace, <b>##other </b> (this |
| allows any well-formed XML that is not from the target namespace of the type |
| being defined) or <b>##targetNamespace </b> (which is shorthand for the target |
| namespace of the type being defined). </li> |
| <li>For a <span class="uicontrol">processContents</span> value, you can select <b>skip</b> (the |
| XML processor will not validate the attribute content at all), <b>lax</b> (the |
| XML processor will validate the attribute content as much as it can), or <b>strict </b> (the |
| XML processor will validate all the attribute content).</li> |
| </ul> |
| </li> |
| </ol> |
| </div> |
| </body> |
| </html> |