Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
Showing
with 473 additions and 105 deletions
/*******************************************************************************
* 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"}
);
type union Mixed_Types
type Mixed_Types_type Mixed_Types
with {
variant "element";
};
type union Mixed_Types_type
{
XSD.GDay alt_,
XSD.GYear alt_1,
......@@ -106,7 +123,6 @@ type union Mixed_Types
}
with {
variant "useUnion";
variant "element";
variant (alt_) "name as ''";
variant (alt_1) "name as ''";
variant (alt_2) "name as ''";
......@@ -121,7 +137,7 @@ with {
};
type Mixed_Types Mixed_Enum (
type Mixed_Types_type Mixed_Enum (
{alt_10:="small"},
{alt_10:="somestring"},
{alt_1:="0085"},
......@@ -138,18 +154,23 @@ type Mixed_Types Mixed_Enum (
);
type union Only_int
type Only_int_type Only_int
with {
variant "element";
};
type union Only_int_type
{
XSD.Integer alt_
}
with {
variant "useUnion";
variant "element";
variant (alt_) "name as ''";
};
type Only_int Ints (
type Only_int_type Ints (
{alt_:=14}
);
......
......@@ -44,7 +44,14 @@ module www_example_org_generate_element_substitution {
import from XSD all;
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,
......@@ -52,7 +59,6 @@ type record ComplexEnum
}
with {
variant "name as uncapitalized";
variant "element";
variant (bar) "attribute";
variant (foo) "attribute";
variant (base) "untagged";
......
......@@ -50,25 +50,38 @@ with {
};
type Foobar FoobarElem
with {
variant "name as uncapitalized";
variant "element";
};
type XSD.Integer Ding
with {
variant "name as uncapitalized";
};
type record Bar
type Bar_type Bar
with {
variant "name as uncapitalized";
variant "element";
};
type record Bar_type
{
XSD.String something optional
}
with {
variant "name as uncapitalized";
variant "element";
};
}
with {
encode "XML";
variant "namespace as 'www.example.org/imported2'";
variant "namespace as 'www.example.org/imported2' prefix 'this'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
......@@ -56,11 +56,11 @@ with {
type record Type
{
Foobar something optional,
Foobar foobar
FoobarElem foobarElem
}
with {
variant "element";
variant (foobar) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (foobarElem) "namespace as 'www.example.org/imported2' prefix 'other'";
};
......@@ -68,8 +68,8 @@ type record OtherType
{
Foobar billingAccountNumber,
Foobar something,
Bar something2,
Bar something3,
Bar_type something2,
Bar_type something3,
record {
XSD.String something
} something4
......@@ -77,7 +77,6 @@ type record OtherType
with {
variant (billingAccountNumber) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something2) "namespace as 'www.example.org/imported2' prefix 'other'";
};
......
......@@ -44,11 +44,13 @@ module www_example_org_only_element_substitution {
import from XSD all;
type RequestAbstractType_group RequestAbstractType1
type record RequestAbstractType
{
XSD.String commonName
}
with {
variant "name as uncapitalized";
variant "abstract";
variant "element";
};
......@@ -80,18 +82,28 @@ with {
};
type union RequestAbstractType_group
type record Ize
{
record of RequestAbstractType1_group requestAbstractType1_list
}
with {
variant "name as uncapitalized";
variant "element";
variant (requestAbstractType1_list) "untagged";
variant (requestAbstractType1_list[-]) "name as 'requestAbstractType1'";
};
type union RequestAbstractType1_group
{
record {
XSD.String commonName
} requestAbstractType,
RequestAbstractType requestAbstractType1,
ProductionRequest productionRequest,
ProgrammingRequest programmingRequest
}
with {
variant "untagged";
variant (requestAbstractType) "form as qualified";
variant (requestAbstractType) "abstract";
variant (requestAbstractType1) "form as qualified";
variant (requestAbstractType1) "abstract";
};
......
......@@ -51,36 +51,36 @@ import from www_example_org_pref3 all;
type record MyElement_2
{
www_example_org_pref2.MyElement myElement optional,
www_example_org_pref2.MyElement2 myElement2 optional,
MyAttribute myAttribute optional,
MyAttribute2 myAttribute2 optional,
XSD.Integer myField,
www_example_org_pref2.MyType myField2,
www_example_org_pref2.MyElement myElement_1,
www_example_org_pref2.MyElement2 myElement2_1
www_example_org_pref2.MyElement myElement,
www_example_org_pref2.MyElement2 myElement2
}
with {
variant "name as 'MyElement'";
variant "element";
variant (myAttribute) "name as capitalized";
variant (myAttribute) "namespace as 'www.example.org/pref2' prefix 'ns2'";
variant (myAttribute) "attribute";
variant (myAttribute2) "name as capitalized";
variant (myAttribute2) "namespace as 'www.example.org/pref2' prefix 'ns2'";
variant (myAttribute2) "attribute";
variant (myElement) "name as capitalized";
variant (myElement) "namespace as 'www.example.org/pref2' prefix 'ns2'";
variant (myElement) "attribute";
variant (myElement2) "name as capitalized";
variant (myElement2) "namespace as 'www.example.org/pref2' prefix 'ns2'";
variant (myElement2) "attribute";
variant (myElement_1) "name as 'MyElement'";
variant (myElement_1) "namespace as 'www.example.org/pref2' prefix 'ns2'";
variant (myElement2_1) "name as 'MyElement2'";
variant (myElement2_1) "namespace as 'www.example.org/pref2' prefix 'ns2'";
};
type www_example_org_pref2.MyElement MyElement
type www_example_org_pref2.MyType MyElement
with {
variant "element";
};
type www_example_org_pref2.MyElement2 MyElement_1
type www_example_org_pref2.MyType MyElement_1
with {
variant "name as 'MyElement'";
variant "element";
......
......@@ -55,6 +55,18 @@ with {
};
type MyType MyAttribute
with {
variant "attribute";
};
type MyType MyAttribute2
with {
variant "attribute";
};
type record MyType
{
XSD.Integer myField
......
......@@ -212,7 +212,7 @@ type record ComplexSimpleNotAlias_1
{
XSD.String attrgroup1 optional,
XSD.String attrgroup2 optional,
XSD.String base length(4 .. infinity)
Length_1 base length(4 .. infinity)
}
with {
variant "name as 'ComplexSimpleNotAlias'";
......@@ -231,7 +231,7 @@ type LengthAlias2 ComplexSimpleAlias2;
type record ComplexSimpleNotAlias2
{
XSD.String attr optional,
XSD.String base length(4 .. infinity)
Length_1 base length(4 .. infinity)
}
with {
variant (attr) "attribute";
......
......@@ -44,27 +44,33 @@ module www_example_org_simpletype_ref {
import from XSD all;
type record SomeType
type SomeType_type SomeType
with {
variant "element";
};
type record SomeType_type
{
XSD.String something
}
};
type Type_type Type
with {
variant "element";
};
type record Type
type record Type_type
{
XSD.String something optional
}
with {
variant "element";
};
type record OtherType
{
SomeType billingAccountNumber,
SomeType_type billingAccountNumber,
XSD.Long installmentPlanId (-99999 .. 99999),
XSD.String info length(0 .. 30) optional
};
......
......@@ -50,22 +50,35 @@ with {
};
type XSD.String Member
type Head_type Member
with {
variant "name as uncapitalized";
variant "element";
};
type enumerated StringEnum
type record StringEnum
{
else_,
something
XSD.String headAttrib,
XSD.String something
}
with {
variant "text 'else_' as 'else'";
variant "name as uncapitalized";
variant "element";
variant (headAttrib) "attribute";
variant (something) "name as capitalized";
};
type record Head_type
{
XSD.String headAttrib optional,
XSD.String something
}
with {
variant "name as uncapitalized";
variant (headAttrib) "attribute";
variant (something) "name as capitalized";
};
......@@ -105,10 +118,7 @@ with {
type union Head_group_1
{
record {
XSD.String headAttrib optional,
XSD.String something
} head,
Head_type head,
Member member,
Member2 member2,
StringEnum stringEnum
......@@ -117,8 +127,6 @@ with {
variant "untagged";
variant (head) "form as qualified";
variant (head) "abstract";
variant (head.headAttrib) "attribute";
variant (head.something) "name as capitalized";
variant (member) "block";
variant (member2) "block";
variant (stringEnum) "block";
......
......@@ -44,6 +44,16 @@ module www_example_org_substitutiongroup {
import from XSD all;
/* TEST IF THE ELEMENT REFERENCE IS FOUND */
type XSD.Integer Head
with {
variant "name as uncapitalized";
variant "attribute";
};
/* THE HEAD ELEMENT */
......
......@@ -47,13 +47,6 @@ import from XSD all;
import from www_example_org_substitutiongroup_ref all;
type Subsgroup_group Refgroup
with {
variant "name as uncapitalized";
variant "element";
};
type record ComplexGroup
{
Subsgroup_group subsgroup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment