Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
3abe9331 | 2 | * Copyright (c) 2000-2015 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 | |
7 | ******************************************************************************/ | |
8 | /* Annex C (formerly B) Example 3 | |
9 | ||
10 | XML Schema: | |
11 | ||
12 | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:nsA" | |
13 | targetNamespace="nsA"> | |
14 | <xs:complexType name="C1"> | |
15 | <xs:simpleContent> | |
16 | <xs:extension base="xs:integer"> | |
17 | <xs:attribute name="A1" type="xs:integer"/> | |
18 | <xs:attribute name="A2" type="xs:integer"/> | |
19 | </xs:extension> | |
20 | </xs:simpleContent> | |
21 | </xs:complexType> | |
22 | <xs:complexType name="C2"> | |
23 | <xs:simpleContent> | |
24 | <xs:restriction base="C1"> | |
25 | <xs:minInclusive value="23"/> | |
26 | <xs:maxInclusive value="26"/> | |
27 | <xs:attribute name="A1" type="xs:byte" use="required"/> | |
28 | <xs:attribute name="A2" type="xs:negativeInteger"/> | |
29 | </xs:restriction> | |
30 | </xs:simpleContent> | |
31 | </xs:complexType> | |
32 | <xs:complexType name="C3"> | |
33 | <xs:simpleContent> | |
34 | <xs:restriction base="C2"> | |
35 | <xs:minInclusive value="25"/> | |
36 | <xs:maxInclusive value="26"/> | |
37 | </xs:restriction> | |
38 | </xs:simpleContent> | |
39 | </xs:complexType> | |
40 | </xs:schema> | |
41 | ||
42 | TTCN-3 Module: | |
43 | */ | |
44 | module AnnexB3 { | |
45 | ||
46 | //import from XSD language "XML" all; | |
47 | ||
48 | type record C1 { | |
49 | integer a1 optional, | |
50 | integer a2 optional, // attributes first | |
51 | universal charstring base // originally integer | |
52 | } with { | |
53 | variant (a1, a2) "attribute"; | |
54 | // name as capitalized factored out | |
55 | variant (base) "untagged "; | |
56 | } | |
57 | ||
58 | type record C2 { | |
59 | integer a1, | |
60 | integer a2 optional, | |
61 | integer base (23 .. 26) | |
62 | } with { | |
63 | variant (a1, a2) "attribute"; | |
64 | // name as capitalized factored out | |
65 | variant (base) "untagged " ; | |
66 | } | |
67 | ||
68 | type record C3 { | |
69 | integer a1, | |
70 | integer a2 optional, | |
71 | integer base (25 .. 26) | |
72 | } with { | |
73 | variant (a1, a2) "attribute"; | |
74 | // name as capitalized factored out | |
75 | variant (base) "untagged " | |
76 | } | |
77 | ||
78 | } with { | |
79 | encode "XML"; | |
80 | variant /* (all, all.all)*/ "name as capitalized"; | |
81 | variant /*(all)*/ "namespace as 'urn:nsA' prefix 'A' " | |
82 | } | |
83 |