| <?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 lang="en-us" xml:lang="en-us"> |
| <head> |
| <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> |
| <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" /> |
| <meta name="DC.rights.owner" content="(C) Copyright 2000, 2008" /> |
| <meta content="public" name="security" /> |
| <meta content="index,follow" name="Robots" /> |
| <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))' /> |
| <meta content="task" name="DC.Type" /> |
| <meta name="DC.Title" content="Adding content models" /> |
| <meta name="abstract" content="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." /> |
| <meta name="description" content="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." /> |
| <meta content="XML schema editor, content models, XML schema files" name="DC.subject" /> |
| <meta content="XML schema editor, content models, XML schema files" name="keywords" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/taddanye.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/taddelm.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/taddelmr.html" /> |
| <meta scheme="URI" name="DC.Relation" content="../topics/taddgrpr.html" /> |
| <meta content="XHTML" name="DC.Format" /> |
| <meta content="taddcmod" name="DC.Identifier" /> |
| <meta content="en-us" name="DC.Language" /> |
| <link href="../../org.eclipse.wst.doc.user/common.css" type="text/css" rel="stylesheet" /> |
| <title>Adding content models</title> |
| </head> |
| <body id="taddcmod"><a name="taddcmod"><!-- --></a> |
| |
| |
| <h1 class="topictitle1">Adding content models</h1> |
| |
| |
| |
| |
| <div><p>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.</p> |
| |
| <div class="section"><div class="p">There are three different kinds of content models:<ul> |
| <li><strong>Sequence</strong>, which means that all the content model's children can |
| appear in an instance of the XML schema. They must, however, appear in the |
| order they are listed in the content model.</li> |
| |
| <li><strong>Choice</strong>, which means that only one of the content model's children |
| can appear in an instance of the XML schema.</li> |
| |
| <li><strong>All</strong>, which means that all of the content model's children can appear |
| once or not at all, and they can appear in any order. If you select this option, |
| all of the contents model's children must be individual elements and no element |
| in the content model can appear more than once.</li> |
| |
| </ul> |
| </div> |
| <p>The following instructions were written for the Resource perspective, |
| but they will also work in many other perspectives.</p> |
| <p>To add a content |
| model to an element, global element, complex type, or group, complete the |
| following steps:</p> |
| </div> |
| |
| <ol> |
| <li class="stepexpand"><span>In the Design view, select your complex type, or group:</span> |
| <ul> |
| <li>If you selected a complex type, you can right-click it and click <span class="uicontrol">Add |
| Sequence</span>, or <span class="uicontrol">Add Choice</span> to add the type |
| of content model you want to your complex type. If you wish to use the <span class="uicontrol">all</span> content |
| model, you can change the model by clicking the model in the Design view, |
| and in properties, select <span class="uicontrol">all</span> as the <span class="uicontrol">Kind</span>. |
| Your content model is automatically added as a child of your complex type |
| - expand in the Outline view to see it. <strong>Note:</strong> These options will not |
| appear if you have set a base type for your complex type. You can either set |
| a base type for your complex type, or you add a content model to it, but you |
| cannot do both.</li> |
| |
| <li>Your group is automatically created with a sequence content model |
| child. Expand it in the Outline view to see it and select it. In the Properties |
| view, you can select to change it to a <span class="uicontrol">choice</span> or <span class="uicontrol">all</span> content |
| model by selecting these options from the <span class="uicontrol">Kind</span> drop-down.</li> |
| |
| </ul> |
| |
| </li> |
| |
| <li class="stepexpand"><strong>Optional: </strong><span>Select the appropriate value in the <span class="uicontrol">Minimum |
| Occurrence</span> field.</span> This is the minimum |
| number of times the content model must appear. If you want the content model |
| to be optional, select <span class="uicontrol">0</span>. Otherwise, select <span class="uicontrol">1</span>. |
| </li> |
| |
| <li class="stepexpand"><strong>Optional: </strong><span>Select the appropriate value in the <span class="uicontrol">Maximum |
| Occurrence</span> field.</span> This is the maximum number of times |
| a content model can appear. You can select <span class="uicontrol">unbounded</span> to |
| indicate there is no maximum number of occurrences.</li> |
| |
| <li class="stepexpand"><span>Click the <span class="uicontrol">Documentation</span> tab if you want |
| to provide any information about this content model.</span> The <span class="uicontrol">Documentation</span> page |
| is used for human readable material, such as a description.</li> |
| |
| <li class="stepexpand"><span>Click the <span class="uicontrol">Extensions</span> tab if you want to |
| add application information elements to your annotations of schema components.</span> |
| The <span class="uicontrol">Extensions</span> page allows you to specify the |
| schema and add XML content to your annotations.</li> |
| |
| </ol> |
| |
| <div class="section"><p>You can add the following items to a content object model: </p> |
| <ul> |
| <li>Another content model.</li> |
| |
| <li>A group reference which enables the referenced group to appear in the |
| instance document in the context of the referencing declaration. This menu |
| option only appears if there are global groups defined elsewhere in the document |
| or if groups are defined in included schemas.</li> |
| |
| <li>An element, fundamental building blocks in XML.</li> |
| |
| <li>An element reference, which provides a reference to a global element. |
| This menu option only appears if there are global elements defined elsewhere |
| in the document.</li> |
| |
| <li>An <samp class="codeph">any</samp> element. You can use an <samp class="codeph">any</samp> element |
| to extend your content model by any elements belonging to a specified namespace.</li> |
| |
| </ul> |
| </div> |
| |
| </div> |
| |
| <div><div class="reltasks"><strong>Related tasks</strong><br /> |
| <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> |
| <div><a href="../topics/taddelm.html" title="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.">Adding elements</a></div> |
| <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> |
| <div><a href="../topics/taddgrpr.html" title="A group reference is a declaration that references a group. It enables the referenced group to appear in the instance document in the context of the referencing declaration.">Adding group references</a></div> |
| </div> |
| </div> |
| |
| </body> |
| </html> |