Liquid XML Studio
Element Definition Simple Content
Send Feedback
XSD Editor > Graphical Notation Overview > Element > Element Definition Simple Content

Glossary Item Box

Graphical Representation

Summary

The <xs:element> allows you to define an element within the XML document. An element can either be defined globally i.e. as a child of the <xs:schema>, or locally within a compositor (<xs:all>, <xs:choice>, <xs:sequence>). A globally defined <xs:element> can be used as the root element within an XML document, and can also be re-used within the schema. Locally defined elements can only appear within there containing element.

There are a number of forms that an element can take.

Depending on the form a given element takes, the properties applicable to it can be greatly changed.

This topic covers the 'Simple Content  form. Typically you can change the form that an element takes by changing the Type property.

In this form an element extends or restricts an existing primitive type, this can be one of the built in types (int, datetimebase64 etc), or one you have defined yourself using the <xs:simpleType>.

Note: An element based on a simple type can only contain data and have attributes, it can not have child compositor or elements.

Creating

An <xs:element> that extends or restricts an existing simple type can be created by selecting a compositor (<xs:all>, <xs:choice>, <xs:sequence>) or <schema> object. Then right clicking and selecting Add Child->Element, the type property can then be set to an existing simpleType.

Properties

Min Occurs - the minimum number of times the element must appear in the XML Document (default 1).
Max Occurs - The maximum number of times the element  can appear in the XML Document (default 1).
Name - The name of the element as it will appear in the XML Document, if the elements parent is <xs:schema> then this name should be unique.
Simple Content Type - Effects the value of the element. Restriction, the type selected is being restricted. The restrictions come in the form of facets. Union, the value can take any valid value from the list of types defined in the Union Types property. List, the value can be a number of valid values for the Type selected. These values are white space separated in the XML document.
Type - The simple type that is being used as the base for this element (only available when the Simple Content Type, is NOT set to union).
Union Type - The list of types that are valid as values for the element (only available when the Simple Content Type, is set to union).
Facets - See Facets Information
Abstract
 - Indicates that the element can not actually appear in the XML document. But can be used as a building block or substitution for other elements.
Block - Indicates that the element can not be substituted, extended or restricted - see 'Derived By' Property and Substitution Groups on <xs:element>.
Default - The default value given to the element. If the element is not specified then a parser should use this value in its place (Default and Fixed are mutually exclusive).
Final - .
Fixed - The value that the element has to take (Default and Fixed are mutually exclusive).
Form -
Id - A user defined ID to uniquely identify the entity within the schema.
Nillable - Indicates that the element in the XML document can be omitted (there are compatibility issues when using this flag and XML Data Binding, for this reason it is best avoided if possible).

Sample 1

The following XSD code

<xs:element name="SuitableDates">

<xs:simpleType>

<xs:list itemType="xs:date" />

</xs:simpleType>

</xs:element>

Will be represented like this

 

Sample XML would look like this (space separated list)

<?xml version="1.0" encoding="utf-16"?>

<SuitableDates>2000-01-12 2000-01-15 2000-01-18</SuitableDates>

Sample 2

The following XSD code

<xs:element name="Line1">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:maxlength value="40" />

</xs:restriction>

</xs:simpleType>

</xs:element>

Will be represented like this

 

Sample XML would look like this, where the contents '12 SomePlace St' is not more than 40 chars long.

<?xml version="1.0" encoding="utf-16"?>

<Line1>12 SomePlace St</Line1>
 

Sample 3

The following XSD code

<xs:element name="Line1">

<xs:simpleType>

<xs:union memberTypes="xs:dateTime xs:int" />

</xs:simpleType>

</xs:element>

Will be represented like this

 

Sample XML would look like this, where the contents are either a valid int or a valid datetime.

<?xml version="1.0" encoding="utf-16"?>

<Line1>46</Line1>

or

<?xml version="1.0" encoding="utf-16"?>

<Line1>2000-01-12T12:13:14Z</Line1>

ShowInline Properties

Properties that apply to a type are shown inline at the bottom of the items container.

Values that are inherited from the base types are shown in brackets, values specifically set against the item are shown without brackets.

If a facet is not valid for a given type (typically because of its data type), then its value is shown in red.

Inline properties can be disabled in the Options.