--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2016 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R5A
+*
+* 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: www_example_org_enumeration_restriction3_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue May 31 11:21:08 2015
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - enumeration_restriction3_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/enumeration_restriction3/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_enumeration_restriction3 {
+
+
+import from XSD all;
+
+
+type CType C
+with {
+ variant "element";
+};
+
+
+type enumerated CType
+{
+ b2,
+ uNKNOWN
+}
+with {
+ variant "text 'b2' as capitalized";
+ variant "text 'uNKNOWN' as capitalized";
+};
+
+
+type enumerated CTypeEnum
+{
+ b2
+}
+with {
+ variant "text 'b2' as capitalized";
+};
+
+
+type CTypeEnum C2
+with {
+ variant "element";
+};
+
+
+type enumerated Mountainbikesize
+{
+ medium,
+ small
+}
+with {
+ variant "name as uncapitalized";
+};
+
+
+type record FamilyMountainBikeSizes
+{
+ XSD.String familyMember optional,
+ Mountainbikesize base
+}
+with {
+ variant (familyMember) "attribute";
+ variant (base) "untagged";
+};
+
+
+type record ChildMountainBikeSizes
+{
+ XSD.String familyMember optional,
+ enumerated {
+ small
+ } base
+}
+with {
+ variant (familyMember) "attribute";
+ variant (base) "untagged";
+};
+
+
+}
+with {
+ encode "XML";
+ variant "namespace as 'www.example.org/enumeration_restriction3' prefix 'nse'";
+ variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
<File path="../xsd/including_module.xsd" />
<File path="../xsd/included_without_namespace.xsd" />
<File path="../xsd/list_complextype.xsd" />
+ <File path="../xsd/enumeration_restriction3.xsd" />
</File_Group>
<File_Group name="XmlTest_xsds" >
<File path="../XmlTest_xsds/XmlTest_boolean.xsd" />
<File path="../XmlTest_expectedTtcns/www_example_org_attribute_enumeration_variant_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_including_module_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_list_complextype_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn" />
</File_Group>
<File_Group name="XmlTest_src" >
<File path="xmlTest_Shell.ttcn" />
}
}
+ testcase tc_enumeration_restriction3() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn enumeration_restriction3.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_enumeration_restriction3_e.ttcn",
+ "www_example_org_enumeration_restriction3.ttcn", c_numOfDiff_headerAndModuleName);
+ }
+ }
+
+
testcase tc_enumeration_remove_dup() runs on xmlTest_CT {
f_shellCommandWithVerdict("xsd2ttcn enumeration_remove_dup.xsd","",c_shell_successWithoutWarningAndError)
execute(tc_union_optional());//CR_TR18883
execute(tc_enumeration_union_restriction());
execute(tc_enumeration_union_restriction2());
+ execute(tc_enumeration_restriction3());
execute(tc_enumeration_remove_dup());
//===complex===
execute(tc_complex1()); //Passed
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/enumeration_restriction3"
+ xmlns:nse="www.example.org/enumeration_restriction3">
+
+<element name="C">
+ <simpleType>
+ <restriction base="nse:CType" />
+ </simpleType>
+</element>
+
+<simpleType name="CType">
+ <restriction base="string">
+ <maxLength value="32" />
+ <enumeration value="B2" />
+ <enumeration value="UNKNOWN" />
+ </restriction>
+</simpleType>
+
+<simpleType name="CTypeEnum">
+ <restriction base="nse:CType" >
+ <enumeration value="B2" />
+ </restriction>
+</simpleType>
+
+<element name="C2" type="nse:CTypeEnum"/>
+
+
+<simpleType name="mountainbikesize">
+ <restriction base="string">
+ <enumeration value="small"/>
+ <enumeration value="medium"/>
+ </restriction>
+</simpleType>
+
+<complexType name="FamilyMountainBikeSizes">
+ <simpleContent>
+ <extension base="nse:mountainbikesize">
+ <attribute name="familyMember" type="string" />
+ </extension>
+ </simpleContent>
+</complexType>
+
+<complexType name="ChildMountainBikeSizes">
+ <simpleContent>
+ <restriction base="nse:FamilyMountainBikeSizes" >
+ <enumeration value="small"/>
+ </restriction>
+ </simpleContent>
+</complexType>
+
+
+</schema>
st->addToNameDepList(basefield);
basefield->nameDep = st;
addNameSpaceAsVariant(basefield, st);
+ const Mstring old_type = basefield->getType().originalValueWoPrefix;
+ basefield->applyReference(*st);
+ // If st has enumeration then the type is restored to the original value
+ // because enumerations cannot be extended here and this way we just
+ // we just create an alias.
+ if (st->getEnumeration().modified) {
+ basefield->setTypeValue(old_type);
+ basefield->getEnumeration().modified = false;
+ }
}
} else if(!isBuiltInType(basefield->getType().convertedValue)){
printError(module->getSchemaname(), name.convertedValue,
void EnumerationType::applyReference(const EnumerationType & other) {
if (!modified) modified = other.modified;
- for (List<Mstring>::iterator facet = other.facets.begin(); facet; facet = facet->Next) {
- facets.push_back(facet->Data);
+ if ((other.parent->getXsdtype() == n_NOTSET && parent->getMode() != SimpleType::restrictionMode)
+ || parent->getXsdtype() == n_simpleType) {
+ for (List<Mstring>::iterator facet = other.facets.begin(); facet; facet = facet->Next) {
+ facets.push_back(facet->Data);
+ }
}
}