Commit f69687a5 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

xsd2ttcn: Is now more restrictive about ref and type attribute values (Bug 521797)



Change-Id: Ibe5636cd2d0f121d08aee7db2590f23a79dcea3c
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent 8879474a
/*******************************************************************************
* Copyright (c) 2000-2017 Ericsson Telecom AB
*
* XSD to TTCN-3 Translator
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Balasko, Jeno
* Szabo, Bence Janos
*
******************************************************************************/
//
// File: http_www_example_org_correct_ref_and_type.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Wed Sep 6 13:38:35 2017
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - correct_ref_and_type.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "http://www.example.org/correct/ref/and/type" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module http_www_example_org_correct_ref_and_type {
import from XSD all;
type record A_3
{
XSD.AnySimpleType aGroup
}
with {
variant "untagged";
};
type record B_2
{
XSD.AnySimpleType bGroup,
XSD.AnySimpleType aGroup
}
with {
variant "untagged";
};
type record B_1
{
A_2 baseAttr optional,
XSD.String baseElem
}
with {
variant "name as 'B'";
variant (baseAttr) "attribute";
};
type XSD.Integer A_1
with {
variant "name as 'A'";
variant "attribute";
};
type XSD.Integer B
with {
variant "attribute";
};
type XSD.Integer C
with {
variant "attribute";
};
type XSD.Integer A
with {
variant "element";
};
type enumerated A_2
{
simpleType,
simpleType1
}
with {
variant "text 'simpleType' as capitalized";
variant "text 'simpleType1' as capitalized";
variant "name as 'A'";
};
type union C_1
{
XSD.Integer alt_,
XSD.String alt_1
}
with {
variant "name as 'C'";
variant "useUnion";
variant (alt_) "name as ''";
variant (alt_1) "name as ''";
};
type record Element
{
A_1 a optional,
XSD.Integer attr optional,
B b optional,
A_2 simpleTypeAttr optional,
C_1 simpleTypeAttr2 optional,
A a_1,
A_2 simpleTypeRef,
B_1 complexTypeRef,
XSD.AnySimpleType bGroup,
XSD.AnySimpleType aGroup
}
with {
variant "element";
variant (a) "name as capitalized";
variant (a) "attribute";
variant (attr) "name as capitalized";
variant (attr) "attribute";
variant (b) "name as capitalized";
variant (b) "attribute";
variant (simpleTypeAttr) "name as capitalized";
variant (simpleTypeAttr) "attribute";
variant (simpleTypeAttr2) "name as capitalized";
variant (simpleTypeAttr2) "attribute";
variant (a_1) "name as 'A'";
variant (simpleTypeRef) "name as capitalized";
variant (complexTypeRef) "name as capitalized";
};
type enumerated AExtension
{
simpleType
}
with {
variant "text 'simpleType' as capitalized";
};
type A_2 AType
with {
variant "element";
};
type A_2 AAttr
with {
variant "attribute";
};
type B_1 BType
with {
variant "element";
};
type B_1 BAttr
with {
variant "attribute";
};
type record SimpleTypExtension
{
XSD.Integer attr optional,
A_2 base
}
with {
variant (attr) "attribute";
variant (base) "untagged";
};
type record SimpleTypeRestriction
{
enumerated {
simpleType
} base
}
with {
variant (base) "untagged";
variant (base) "text 'simpleType' as capitalized";
};
type record ComplexTypeExtension
{
A_2 extattr optional,
A_2 baseAttr optional,
XSD.String baseElem,
XSD.Integer extelem
}
with {
variant (extattr) "name as capitalized";
variant (extattr) "attribute";
variant (baseAttr) "attribute";
variant (extelem) "name as capitalized";
};
type record ComplexTypeRestriction
{
XSD.String baseElem
};
type record ComplexTypeGroup
{
record length(1 .. 4) of B_2 b_list
}
with {
variant (b_list) "untagged";
};
}
with {
encode "XML";
variant "namespace as 'http://www.example.org/correct/ref/and/type' prefix 'this'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
......@@ -44,23 +44,35 @@ module name_conversion_extension_attrib {
import from XSD all;
type record Ol_name_type
type Ol_name_type_type Ol_name_type
with {
variant "name as 'Ol-name-type'";
variant "element";
};
type record Ol_name_type_type
{
XSD.Integer allow_true_action
}
with {
variant "name as 'Ol-name-type'";
variant "element";
variant "name as 'Ol-name-type_type'";
variant (allow_true_action) "name as 'allow-true-action'";
};
type XSD.String Attr
with {
variant "attribute";
};
type record Ol_actions_type
{
XSD.Integer do_not_disturb,
record {
Ol_name_type announcement_name,
Ol_name_type content optional
Attr attr,
Ol_name_type_type content optional
} play_segmented_announcement
}
with {
......@@ -69,8 +81,8 @@ with {
variant (do_not_disturb) "name as 'do-not-disturb'";
variant (play_segmented_announcement) "name as 'play-segmented-announcement'";
variant (play_segmented_announcement) "useNil";
variant (play_segmented_announcement.announcement_name) "name as 'announcement-name'";
variant (play_segmented_announcement.announcement_name) "attribute";
variant (play_segmented_announcement.attr) "name as capitalized";
variant (play_segmented_announcement.attr) "attribute";
};
......@@ -78,7 +90,7 @@ type record Ol_actions_type2
{
XSD.Integer do_not_disturb,
record {
Ol_name_type announcement_name,
Attr attr,
record {
XSD.Integer allow_true_action,
XSD.String elem
......@@ -91,8 +103,8 @@ with {
variant (do_not_disturb) "name as 'do-not-disturb'";
variant (play_segmented_announcement) "name as 'play-segmented-announcement'";
variant (play_segmented_announcement) "useNil";
variant (play_segmented_announcement.announcement_name) "name as 'announcement-name'";
variant (play_segmented_announcement.announcement_name) "attribute";
variant (play_segmented_announcement.attr) "name as capitalized";
variant (play_segmented_announcement.attr) "attribute";
variant (play_segmented_announcement.content.allow_true_action) "name as 'allow-true-action'";
};
......
......@@ -63,12 +63,16 @@ import from www_XmlTest_org_complex_import_B all;
type record PurchaseReportImport
{
www_XmlTest_org_complex_import_A.MyType myTypeA,
www_XmlTest_org_complex_import_B.MyType myTypeB
www_XmlTest_org_complex_import_A.MyType myType,
www_XmlTest_org_complex_import_B.MyType myType_1
}
with {
variant "name as uncapitalized";
variant "element";
variant (myType) "name as capitalized";
variant (myType) "namespace as 'www.XmlTest.org/complex_import_A' prefix 'A'";
variant (myType_1) "name as 'MyType'";
variant (myType_1) "namespace as 'www.XmlTest.org/complex_import_B' prefix 'B'";
};
......
......@@ -92,7 +92,7 @@ with {
};
type Non_empty_string Non_empty_stringChild length(0 .. infinity)
type XSD.String Non_empty_stringChild length(3)
with {
variant "name as 'Non-empty-stringChild'";
};
......
......@@ -66,8 +66,8 @@ type record E29a
XSD.String ding
}
with {
variant "name as uncapitalized";
variant "useOrder";
variant "untagged";
};
......
......@@ -57,18 +57,24 @@ with {
variant "name as uncapitalized";
variant (attrInGroup1) "attribute";
variant (attrInGroup2) "attribute";
variant (attr) "anyAttributes from 'http://www.w3.org/1999/xhtml','www.example.org/anyattrib/single','www.example.org/anyattrib/single'";
variant (attr) "anyAttributes from 'http://www.w3.org/1999/xhtml', 'www.example.org/anyattrib/single', 'www.example.org/anyattrib/single'";
};
type record E45c
type E45c_type E45c
with {
variant "name as uncapitalized";
variant "element";
};
type record E45c_type
{
record of XSD.String attr optional
}
with {
variant "name as uncapitalized";
variant "element";
variant (attr) "anyAttributes from unqualified,'http://www.example.org/attribute'";
variant (attr) "anyAttributes from unqualified, 'http://www.example.org/attribute'";
};
......@@ -79,7 +85,7 @@ type record E45d
with {
variant "name as uncapitalized";
variant "element";
variant (attr) "anyAttributes from 'www.example.org/anyattrib/single',unqualified,'http://www.example.org/attribute'";
variant (attr) "anyAttributes from 'www.example.org/anyattrib/single', unqualified, 'http://www.example.org/attribute'";
};
......@@ -125,7 +131,7 @@ type record MyType2
with {
variant "element";
variant (ding) "attribute";
variant (attr) "anyAttributes from 'www.example.org/anyattrib/single',unqualified, 'www.example.org/anyattrib/single'";
variant (attr) "anyAttributes from 'www.example.org/anyattrib/single', unqualified, 'www.example.org/anyattrib/single'";
};
......
......@@ -99,16 +99,9 @@ with {
};
type record E25seqd
{
XSD.Integer gender optional,
XSD.Integer genderAttrBase,
XSD.Integer ageElemExt
}
type E25seqc E25seqd
with {
variant "name as uncapitalized";
variant (gender) "attribute";
variant (genderAttrBase) "attribute";
};
......@@ -147,7 +140,14 @@ with {
};
type record E23
type E23_type E23
with {
variant "name as uncapitalized";
variant "element";
};
type record E23_type
{
XSD.Integer bar optional,
XSD.Integer base optional,
......@@ -156,7 +156,6 @@ type record E23
}
with {
variant "name as uncapitalized";
variant "element";
variant (bar) "attribute";
variant (base) "attribute";
variant (foo) "attribute";
......@@ -165,7 +164,14 @@ with {
};
type record E24
type E24_type E24
with {
variant "name as uncapitalized";
variant "element";
};
type record E24_type
{
XSD.Integer bar optional,
XSD.Integer base optional,
......@@ -175,7 +181,6 @@ type record E24
}
with {
variant "name as uncapitalized";
variant "element";
variant (bar) "attribute";
variant (base) "attribute";
variant (foo) "attribute";
......@@ -185,7 +190,14 @@ with {
};
type record E25
type E25_type E25
with {
variant "name as uncapitalized";
variant "element";
};
type record E25_type
{
XSD.Integer bar optional,
XSD.Integer goo,
......@@ -193,7 +205,6 @@ type record E25
}
with {
variant "name as uncapitalized";
variant "element";
variant (bar) "attribute";
variant (goo) "attribute";
variant (base) "untagged";
......
......@@ -51,7 +51,14 @@ with {
};
type record ComplexEnum
type ComplexEnum_type ComplexEnum
with {
variant "name as uncapitalized";
variant "element";
};
type record ComplexEnum_type
{
XSD.Integer bar optional,
XSD.Float foo optional,
......@@ -59,7 +66,6 @@ type record ComplexEnum
}
with {
variant "name as uncapitalized";
variant "element";
variant (bar) "attribute";
variant (foo) "attribute";
variant (base) "untagged";
......
......@@ -44,7 +44,14 @@ module www_example_org_enumeration_restriction {
import from XSD all;
type union E21unnamed
type E21unnamed_type E21unnamed
with {
variant "name as uncapitalized";
variant "element";
};
type union E21unnamed_type
{
XSD.Integer alt_,
XSD.Float alt_1,
......@@ -53,14 +60,13 @@ type union E21unnamed
with {
variant "name as uncapitalized";
variant "useUnion";
variant "element";
variant (alt_) "name as ''";
variant (alt_1) "name as ''";
variant (alt_2) "name as ''";
};
type E21unnamed E22 (
type E21unnamed_type E22 (
{alt_1:=20.400000},
{alt_2:="small"},
{alt_:=50}
......@@ -70,27 +76,38 @@ with {
};
type union String_int
type String_int_type String_int
with {
variant "element";
};
type union String_int_type
{
XSD.String alt_,
XSD.Integer alt_1
}
with {
variant "useUnion";
variant "element";
variant (alt_) "name as ''";
variant (alt_1) "name as ''";
};
type String_int Everything_is_string (
type String_int_type Everything_is_string (
{alt_:="20.4"},
{alt_:="50"},
{alt_:="small"}