Commit | Line | Data |
---|---|---|
970ed795 EL |
1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2014 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | ******************************************************************************/ | |
8 | /* Annex B Example 1 | |
9 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
10 | <!-- This is an embedded example. An element with a sequence body and an attribute. | |
11 | ||
12 | The sequence body is formed of elements, two of them are also complexTypes.--> | |
13 | <xs:element name="shiporder"> | |
14 | <xs:complexType> | |
15 | <xs:sequence> | |
16 | <xs:element name="orderperson" type="xs:string"/> | |
17 | <xs:element name="shipto"> | |
18 | <xs:complexType> | |
19 | <xs:sequence> | |
20 | <xs:element name="name" type="xs:string"/> | |
21 | <xs:element name="address" type="xs:string"/> | |
22 | <xs:element name="city" type="xs:string"/> | |
23 | <xs:element name="country" type="xs:string"/> | |
24 | </xs:sequence> | |
25 | </xs:complexType> | |
26 | </xs:element> | |
27 | <xs:element name="item"> | |
28 | <xs:complexType> | |
29 | <xs:sequence> | |
30 | <xs:element name="title" type="xs:string"/> | |
31 | <xs:element name="note" type="xs:string" | |
32 | minOccurs="0"/> | |
33 | <xs:element name="quantity" | |
34 | type="xs:positiveInteger"/> | |
35 | <xs:element name="price" type="xs:decimal"/> | |
36 | </xs:sequence> | |
37 | </xs:complexType> | |
38 | </xs:element> | |
39 | </xs:sequence> | |
40 | <xs:attribute name="orderid" type="xs:string" use="required"/> | |
41 | </xs:complexType> | |
42 | </xs:element> | |
43 | </xs:schema> | |
44 | ||
45 | TTCN-3 Module: | |
46 | ||
47 | */ | |
48 | module AnnexB1 | |
49 | { | |
50 | ||
51 | //import from XSD language "XML" all; | |
52 | ||
53 | type record Shiporder { | |
54 | universal charstring orderid, | |
55 | universal charstring orderperson, | |
56 | record | |
57 | { | |
58 | universal charstring name, | |
59 | universal charstring address_1, | |
60 | universal charstring city, | |
61 | universal charstring country | |
62 | } shipto, | |
63 | record | |
64 | { | |
65 | universal charstring title, | |
66 | universal charstring note optional, | |
67 | integer quantity, | |
68 | float price | |
69 | } item | |
70 | } with { | |
71 | variant "name as uncapitalized"; | |
72 | variant (orderid) "attribute "; | |
73 | variant (shipto.address_1) "name as 'address'"; | |
74 | variant (item.price) "XSD:decimal" | |
75 | } // Shiporder | |
76 | ||
77 | } with { | |
78 | encode "XML"; | |
79 | } | |
80 |