Inserting XML Schema elements

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  UML Diagrams > Additional Diagrams > XML Schema Diagrams >

Inserting XML Schema elements

Using the toolbar icons

1.Click the specific XML Schema diagram icon in the toolbar.

xml-schema-ics

2.Click in the XML Schema diagram to insert the element.

 

Note that holding down Ctrl key and clicking in the diagram tab allows you to insert multiple elements of the type you selected.

 

Dragging existing elements into the XML Schema diagram

Elements occurring in other diagrams can be inserted into an existing XML Schema diagram.

 

1.Locate the element you want to insert in the Model Tree tab (you can use the search function text box, or press Ctrl+F to search for any element).
2.Drag the element(s) into the XML Schema diagram. You can also use the Copy and "Paste in diagram only" commands to insert elements.

 

Either method described above applies to any of the XML Schema elements that can be inserted onto the diagram.

 

ic-sch-namesp XSD Target Namespace

Inserts/defines the target namespace for the schema. The XSD Target Namespace must belong to an XSD Namespace Root package.

 

ic-sch-xsd XSD Schema

Inserts/defines an XML schema. The XSD schema must belong to an XSD Target Namespace package.

xsd-in1

 

ic-sch-elemen Element (global)

Inserts a global element into the diagram. Note that a property is also automatically generated in the attributes compartment.

xsd-in2

 

To define the property data type:

1.Double click the property and place the cursor at the end of the line.
2.Enter a colon character ":", and select the data type from the pop-up dialog box, e.g string.

xsd-in3

 

Creating a "content model" consisting of a complexType with mandatory elements

This will entail inserting a complexType element, a sequence element/compositor, and three elements.

1.Click the XSD ComplexType icon ic-sch-compl, then click in the diagram to insert it.
2.Double click the name and change it to Address.

xsd-in4

3.Right click Address and select New | XSD Sequence.

xsd-in5

4.Click the _sequence:mg_sequence attribute in the attribute compartment, and drag it out into the diagram.

xsd-in6

This creates a sequence class/compositor at the drop position.

xsd-in7

5.Right-click the sequence class and select New | XSD Element (local). This adds a new property element.
6.Double-click the property, enter the element name, e.g. Name, add a colon ":" and enter "string" as the data type.

xsd-in8

7.Do the same for the two more elements naming them Street and City for example.
8.Click the Name property and drag it into the diagram.

xsd-in9


© 2019 Altova GmbH