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