Commit e89b6841 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

xsd2ttcn: implemented type aliases when restriction/extension has no real effect (artf640920)



Change-Id: I26d3378f497d30d42bf7e2bd3594beea21234b30
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent ab046b09
......@@ -64,6 +64,81 @@ type record NillableInRecord
XSD.Boolean allow_do_not,
record {
XSD.Integer phoneNumber optional,
SeqNillable content optional
} seqNillableExtended optional
}
with {
variant "element";
variant (allow_do_not) "name as 'allow-do-not'";
//variant (allow_do_not) "text 'true' as '1'";
//variant (allow_do_not) "text 'false' as '0'";
variant (seqNillableExtended) "name as capitalized";
variant (seqNillableExtended) "useNil";
variant (seqNillableExtended.phoneNumber) "name as capitalized";
variant (seqNillableExtended.phoneNumber) "attribute";
};
type record NillableInRecordAlias
{
XSD.Boolean allow_do_not,
record {
SeqNillable content optional
} seqNillableExtended optional
}
with {
variant "element";
variant (allow_do_not) "name as 'allow-do-not'";
//variant (allow_do_not) "text 'true' as '1'";
//variant (allow_do_not) "text 'false' as '0'";
variant (seqNillableExtended) "name as capitalized";
variant (seqNillableExtended) "useNil";
};
type record NillableInRecordNotAlias
{
XSD.Boolean allow_do_not,
record {
record {
XSD.Integer number optional
} content optional
} seqNillableExtended optional
}
with {
variant "element";
variant (allow_do_not) "name as 'allow-do-not'";
//variant (allow_do_not) "text 'true' as '1'";
//variant (allow_do_not) "text 'false' as '0'";
variant (seqNillableExtended) "name as capitalized";
variant (seqNillableExtended) "useNil";
variant (seqNillableExtended.content.number) "name as capitalized";
};
type record SeqNillable2
{
XSD.Integer phoneNumber optional,
XSD.Integer number optional,
record length(0 .. 32) of record {
XSD.Integer content optional
} nillableNumber_list
}
with {
variant (phoneNumber) "name as capitalized";
variant (phoneNumber) "attribute";
variant (number) "name as capitalized";
variant (nillableNumber_list) "untagged";
variant (nillableNumber_list[-]) "name as 'NillableNumber'";
variant (nillableNumber_list[-]) "useNil";
};
type record NillableInRecordRestriction
{
XSD.Boolean allow_do_not,
record {
XSD.Integer phoneNumber,
record {
XSD.Integer number optional,
record length(0 .. 32) of record {
......
......@@ -60,13 +60,33 @@ type record Ol_actions_type
XSD.Integer do_not_disturb,
record {
Ol_name_type announcement_name,
Ol_name_type content optional
} play_segmented_announcement
}
with {
variant "name as 'Ol-actions-type'";
variant "element";
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";
};
type record Ol_actions_type2
{
XSD.Integer do_not_disturb,
record {
XSD.Integer allow_true_action
Ol_name_type announcement_name,
record {
XSD.Integer allow_true_action,
XSD.String elem
} content optional
} play_segmented_announcement
}
with {
variant "name as 'Ol-actions-type'";
variant "name as 'Ol-actions-type2'";
variant "element";
variant (do_not_disturb) "name as 'do-not-disturb'";
variant (play_segmented_announcement) "name as 'play-segmented-announcement'";
......
/******************************************************************************
* Copyright (c) 2000-2016 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:
* Szabo, Bence Janos
*
******************************************************************************/
//
// File: www_example_org_complextype_aliases.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Wed Jun 17 13:42:09 2015
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - complextype_aliases.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "www.example.org/complextype/aliases" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module www_example_org_complextype_aliases {
import from XSD all;
/* Theese types needed to force the nameconversion */
type XSD.AnyType ComplexTypeExtensionNotAlias
with {
variant "name as 'ComplexTypeExtensionNotAlias_'";
variant "element";
};
type XSD.AnyType ComplexTypeRestrictionAlias
with {
variant "name as 'ComplexTypeRestrictionAlias_'";
variant "element";
};
type record ComplexType
{
XSD.Integer elem
};
type ComplexType ComplexTypeExtensionAlias;
/* Not alias because extended with attr attribute */
type record ComplexTypeExtensionNotAlias_1
{
XSD.String attr optional,
XSD.Integer elem
}
with {
variant "name as 'ComplexTypeExtensionNotAlias'";
variant (attr) "attribute";
};
type ComplexTypeExtensionNotAlias_1 ComplexTypeExtensionAlias2;
/* Not alias because extended with elem1 element */
type record ComplexTypeExtensionNotAlias2
{
XSD.String attr optional,
XSD.Integer elem,
XSD.Integer elem1
}
with {
variant (attr) "attribute";
};
type ComplexTypeExtensionNotAlias2 ComplexTypeExtensionAlias3;
/* Not alias because extended with optional sequence */
type record ComplexTypeExtensionNotAlias3
{
XSD.String attr optional,
XSD.Integer elem,
XSD.Integer elem1,
record {
XSD.Integer elem2
} sequence optional
}
with {
variant (attr) "attribute";
variant (sequence) "untagged";
};
type ComplexTypeExtensionNotAlias3 ComplexTypeExtensionAlias4;
/* Resitrictions */
type record ComplexType2
{
XSD.String attr optional,
record length(0 .. 2) of record {
XSD.Integer elem optional,
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
type ComplexType2 ComplexTypeRestrictionAlias_1
with {
variant "name as 'ComplexTypeRestrictionAlias'";
};
type ComplexTypeRestrictionAlias_1 ComplexTypeRestrictionAlias2;
/* Not alias because the minOccurs of the sequence is restricted to 1 */
type record ComplexTypeRestrictionNotAlias
{
XSD.String attr optional,
record length(1 .. 2) of record {
XSD.Integer elem optional,
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
/* Not alias because the minOccurs of the elem element is restricted to 1 */
type record ComplexTypeRestrictionNotAlias2
{
XSD.String attr optional,
record length(0 .. 2) of record {
XSD.Integer elem,
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
/* Not alias because of the elem element is removed */
type record ComplexTypeRestrictionNotAlias3
{
XSD.String attr optional,
record length(0 .. 2) of record {
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
/* Not alias because of the attr attribute is required */
type record ComplexTypeRestrictionNotAlias4
{
XSD.String attr,
record length(0 .. 2) of record {
XSD.Integer elem optional,
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
/* Alias attribute is not mentioned */
type ComplexTypeRestrictionAlias2 ComplexTypeRestrictionAlias3;
/* Not alias because of the elem element's fixed value is 2 */
type record ComplexTypeRestrictionNotAlias5
{
XSD.String attr optional,
record length(0 .. 2) of record {
XSD.Integer elem (2) optional,
record length(1 .. 2) of XSD.Integer elem1_list
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem) "defaultForEmpty as '2'";
variant (sequence_list[-].elem1_list) "untagged";
variant (sequence_list[-].elem1_list[-]) "name as 'elem1'";
};
/* Not alias because of the elem1 element removed and the elem element is not optional */
type record ComplexTypeRestrictionNotAlias6
{
XSD.String attr optional,
record length(0 .. 2) of record {
XSD.Integer elem (2)
} sequence_list
}
with {
variant (attr) "attribute";
variant (sequence_list) "untagged";
variant (sequence_list[-]) "untagged";
variant (sequence_list[-].elem) "defaultForEmpty as '2'";
};
/* Not alias because everything is removed */
type record ComplexTypeRestrictionNotAlias7
{
};
}
with {
encode "XML";
variant "namespace as 'www.example.org/complextype/aliases' prefix 'this'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
......@@ -66,26 +66,18 @@ with {
type record OtherType
{
XSD.Integer billingAccountNumber,
record {
Foobar base
} something,
record {
Bar base
} something2,
record {
XSD.String something optional
} something3,
Foobar billingAccountNumber,
Foobar something,
Bar something2,
Bar something3,
record {
XSD.String something
} something4
}
with {
variant (billingAccountNumber) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something.base) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something.base) "untagged";
variant (something2.base) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something2.base) "untagged";
variant (something) "namespace as 'www.example.org/imported2' prefix 'other'";
variant (something2) "namespace as 'www.example.org/imported2' prefix 'other'";
};
......
/******************************************************************************
* Copyright (c) 2000-2016 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:
* Szabo, Bence Janos
*
******************************************************************************/
//
// File: www_example_org_simpletype_aliases.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Wed Jun 17 13:42:09 2015
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - simpletype_aliases.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "www.example.org/simpletype/aliases" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module www_example_org_simpletype_aliases {
import from XSD all;
/* Theese types needed to force the nameconversion */
type XSD.AnyType Length
with {
variant "name as 'Length_'";
variant "element";
};
type XSD.AnyType ComplexSimpleNotAlias
with {
variant "name as 'ComplexSimpleNotAlias_'";
variant "element";
};
type XSD.AnyType ComplexSimpleAlias3
with {
variant "name as 'ComplexSimpleAlias3_'";
variant "element";
};
type XSD.AnyType ComplexSimpleAlias4
with {
variant "name as 'ComplexSimpleAlias4_'";
variant "element";
};
type enumerated Enumeration
{
a,
b
};
/* Not alias because the restriction element is not empty */
type enumerated EnumerationNotAlias
{
a,
b
};
type Enumeration EnumerationAlias2;
type EnumerationAlias2 EnumerationAlias3;
/* Not alias because it is restricted to 'a' */
type enumerated EnumerationNotAlias2
{
a
};
type XSD.String Pattern (pattern "abcd");
/* Not alias because the restriction element is not empty */
type XSD.String PatternNotAlias (pattern "abcd");
type Pattern PatternAlias;
type PatternAlias PatternAlias2;
/* Not alias because it is restricted to 'abc' */