| <?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 attribute groups</title> |
| </head> |
| <body id="taddagrp"><a name="taddagrp"><!-- --></a> |
| |
| <h1 class="topictitle1">Adding attribute groups</h1> |
| <div><p>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.</p> |
| <div class="section"><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 |
| <b> <span class="uicontrol">Add |
| Attribute Group</span></b>.</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 <b> <span class="uicontrol">Name</span></b> field.</span></li> |
| <li class="skipspace"><span>To add an attribute, right-click your attribute group in the Outline |
| view, click <b> <span class="uicontrol">Add Attribute</span></b>.</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 |
| <b> <span class="uicontrol">Name</span></b> of it.</span></li> |
| <li><span>Click the <b> <span class="uicontrol">Browse</span></b> <img src="../images/Browse.gif" alt="This graphic is the Browse button" /> button and specify the |
| type for the attribute. The</span> Set Type dialog lists all built-in and |
| user-defined types currently available. You can change the <b> |
| <span class="uicontrol">Scope</span></b> of the list by selecting one of the |
| following options: |
| <ul> |
| <li><b><span class="uicontrol">Workspace</span></b>. Lists all of the types |
| available in your workspace. </li> |
| <li><b><span class="uicontrol">Enclosing Project</span>.</b> Lists all of |
| the types available in the project that contains your file. </li> |
| <li>(Default) <b><span class="uicontrol">Current Resource</span>.</b> List |
| all of the types available in your current file.</li> |
| </ul> |
| </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 <b> <span class="uicontrol">Add |
| Attribute Ref</span>.</b></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 <b> <span class="uicontrol">ref</span></b> 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"><b>Add Attribute Group Ref</b></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 <b> <span class="uicontrol">ref</span></b> drop down list.</span></li> |
| </ol> |
| </li> |
| <li class="skipspace"><span>An <samp class="codeph">any</samp> element enables element content according |
| to namespaces, and the corresponding <samp class="codeph">any</samp> attribute |
| element enables attributes to appear in elements. To add an <samp class="codeph">any</samp> attribute, |
| right-click your attribute group and click <b> <span class="uicontrol">Add Any Attribute</span></b>.</span> The <samp class="codeph">any</samp> attribute |
| 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 <b> <span class="uicontrol">processContents</span></b> 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> |