Commit 9ec3c04b authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

xsd2ttcn: Fixed type conversion name following in attributes (Bug 510610)



Change-Id: I939223a5884fd6541c795419d9940ad69b74c005
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent 0854b351
/*******************************************************************************
* 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:
* Szabo, Bence Janos
*
*******************************************************************************/
//
// File: www_example_org_attribute_rename.ttcn
// Description:
// References:
// Rev:
// Prodnr:
// Updated: Wed Jan 18 10:31:58 2017
// Contact: http://ttcn.ericsson.se
//
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - attribute_rename.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "www.example.org/attribute/rename" */
////////////////////////////////////////////////////////////////////////////////
// Modification header(s):
//-----------------------------------------------------------------------------
// Modified by:
// Modification date:
// Description:
// Modification contact:
//------------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
module www_example_org_attribute_rename {
import from XSD all;
type XSD.AnyType GlobalAttrib
with {
variant "name as 'GlobalAttrib_'";
variant "element";
};
type XSD.AnyType MyString
with {
variant "name as 'MyString_'";
variant "element";
};
type XSD.String MyString_1
with {
variant "name as 'MyString'";
};
type MyString_1 GlobalAttrib_1
with {
variant "name as 'GlobalAttrib'";
variant "attribute";
};
type record Complex
{
MyString_1 attrfixedMyString optional,
GlobalAttrib_1 globalAttrib optional,
MyString_1 birthPlaceAttrGroup optional
}
with {
variant (attrfixedMyString) "name as capitalized";
variant (attrfixedMyString) "attribute";
variant (globalAttrib) "name as capitalized";
variant (globalAttrib) "attribute";
variant (birthPlaceAttrGroup) "attribute";
};
}
with {
encode "XML";
variant "namespace as 'www.example.org/attribute/rename' prefix 'attrename'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
variant "elementFormQualified";
}
......@@ -171,6 +171,7 @@
<File path="../xsd/listMinMaxOccurs.xsd" />
<File path="../xsd/simpletype_aliases.xsd" />
<File path="../xsd/complextype_aliases.xsd" />
<File path="../xsd/attribute_rename.xsd" />
</File_Group>
<File_Group name="XmlTest_xsds" >
<File path="../XmlTest_xsds/XmlTest_boolean.xsd" />
......@@ -413,6 +414,7 @@
<File path="../XmlTest_expectedTtcns/http_www_example_org_list_minmaxoccurs_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_simpletype_aliases_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_complextype_aliases_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_attribute_rename_e.ttcn" />
</File_Group>
<File_Group name="XmlTest_src" >
<File path="xmlTest_Shell.ttcn" />
......
......@@ -464,6 +464,15 @@ group Testcases_basedOnTtcnStandard9 {
}
}
testcase tc_attribute_rename() runs on xmlTest_CT
{
f_shellCommandWithVerdict(xsd2ttcn_command & " attribute_rename.xsd","",c_shell_successWithoutWarningAndError);
if(getverdict==pass) {
f_compareFiles(
"www_example_org_attribute_rename_e.ttcn", "www_example_org_attribute_rename.ttcn", c_numOfDiff);
}
}
testcase tc_name_conv_non_alphanumeric() runs on xmlTest_CT
{
f_shellCommandWithVerdict(xsd2ttcn_command & " name_conv_non_alphanumeric.xsd","",c_shell_successWithoutWarningAndError);
......@@ -2573,6 +2582,7 @@ control {
execute(tc_XmlTest_attribute_use_noTNS());//Passed
execute(tc_id_attribute());
execute(tc_attribute_order());
execute(tc_attribute_rename());
execute(tc_name_conv_non_alphanumeric());
execute(tc_module_name_convert_with_diff_namespace());
execute(tc_module_typename_conversion());
......
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema targetNamespace="www.example.org/attribute/rename"
elementFormDefault="qualified"
xmlns:attrename="www.example.org/attribute/rename"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="GlobalAttrib_"/>
<xs:element name="MyString_"/>
<xs:simpleType name="MyString">
<xs:restriction base="xs:string">
</xs:restriction>
</xs:simpleType>
<xs:attribute name="GlobalAttrib" type="attrename:MyString"/>
<xs:attributeGroup name="attrgroup">
<xs:attribute name="birthPlaceAttrGroup" type="attrename:MyString"/>
</xs:attributeGroup>
<xs:complexType name="Complex">
<xs:sequence>
</xs:sequence>
<xs:attributeGroup ref="attrename:attrgroup"/>
<xs:attribute name="AttrfixedMyString" type="attrename:MyString"/>
<xs:attribute ref="attrename:GlobalAttrib"/>
</xs:complexType>
</xs:schema>
......@@ -1689,9 +1689,12 @@ void ComplexType::resolveAttribute(AttributeType* attr) {
attr->setTypeOfField(st->getName().convertedValue);
attr->setNameOfField(st->getName().originalValueWoPrefix);
attr->setOrigModule(st->getModule());
st->addToNameDepList(attr);
} else {
attr->setTypeOfField(st->getName().convertedValue);
if (st->getType().convertedValue == "record" || st->getType().convertedValue == "union") {
if (st->getType().convertedValue == "record" || st->getType().convertedValue == "union"
|| st->getXsdtype() == n_NOTSET) // It really is a simpleType
{
st->addToNameDepList(attr);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment