Defining Elements That Contain Subelements in XML Schemas

An element that contains subelements is a complexType. Consequently, you can define an element that contains subelements in either of the following ways:

  • Define a top-level complexType. That is, it is a child of the xsd:schema node. In the complexType definition, define the subelements. Elsewhere in the schema, define an element that uses the complexType you defined.
  • Define an element that is a child of the xsd:schema node or a Model Group node. In the element definition, define a complexType that contains your subelements.

To define a complexType that contains elements, see Defining complexTypes That Contain Elements and Attributes - Diagram View or Defining complexTypes That Contain Elements and Attributes - Tree View.

Diagram View

To define an element and define subelements in the element definition:
1. Right-click the schema node .
2. In the shortcut menu, select Add > Element.

Alternatives: This operation is also available from the XMLSchema > Diagram > Add > Element menu and from the Add button .

The new element is added to the XML Schema. It is displayed in the diagram and in the text pane (if you have it open). The properties for the new element are displayed in the Properties window.

3. Right-click the new element and click QuickEdit. Select one of the following from the QuickEdit menu:
    • Add Elements Sequence
    • Add Elements Choice
    • Add Elements All
    • Add Elements Any

Stylus Studio updates the element definition to include a complexType with the sequence, choice, all, or any element you selected in the previous step.

4. Add subelements to the element you created in step 3.

Tree View

In the Tree view, to define an element and define subelements in the element definition:
1. Click the Schema node or a Model Group ( all, any, choice, sequence) node.
2. In the left tool bar, click New Element Definition .
3. Enter the name for your new element. Stylus Studio displays a pop-up menu that lists the built-in simpleTypes and any simple or complexTypes already defined in your schema.
4. Press Enter again. Rather that using a type that is already defined, you want to define a new complexType in the definition of your element. You do not want to assign a type to your new element.
5. In the left tool bar, click New complexType .
6. Enter a name for the new type.

At this point, the procedure for defining a complexType in the definition of an element is the same as defining a complexType as a child of the Schema node. See Defining complexTypes That Contain Elements and Attributes - Tree View.

Using XSLT Templates

Using XSLT Templates is an online video demonstration of the Stylus Studio XSLT designer. See just how easy it is to create, apply and match XSLT templates to your XML data to create beautiful HTML layouts for XML content publishing applications.

SQL Server Tools

Integrated SQL Server Tools in Stylus Studio enable you to access relational data stored in SQL Server 2000 or SQL Server 2005 as XML using XQuery, SQL/XML or ADO - learn how to export relational data as XML today!

Single Source Publishing

Single source publishing is the ability to use one source of information for generating multiple types of output. Stylus Studio XML Publishing enables Single Source Publishing - publish PDF or HTML documents from Relational, XML or Legacy files.

Database-to-XML Mapping

Stylus Studio features several database-to-XML mapping tools that allow you to easily query a relational database using SQL/XML or SQL and render the results as XML. Stylus Studio also supports the world's first and only visual SQL/XML Editor!

Stylus Most Wanted

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.