Commit 9371a2f9 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

xsd2ttcn: updated name clash fix to work with 3 or more modules (bug 541748)



Change-Id: I38e7b4868f0ad1f43a0ee74e00793eca1f4c008a
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 1d589791
......@@ -140,4 +140,31 @@ with {
}
////////////////////////////////////////////////////////////////////////////////
// Generated from file(s):
// - name_clashes_and_references_C.xsd
// /* xml version = "1.0" encoding = "UTF-8" */
// /* targetnamespace = "http://somewhere.com/C" */
////////////////////////////////////////////////////////////////////////////////
group http_somewhere_com_C {
import from XSD all;
type XSD.String SimpleType_2
with {
variant "name as 'SimpleType'";
};
}
with {
encode "XML";
variant "namespace as 'http://somewhere.com/C'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
variant "elementFormQualified";
}
}
......@@ -149,6 +149,7 @@
<File path="../xsd/substitution_group_two.xsd" />
<File path="../xsd/name_clashes_and_references_A.xsd" />
<File path="../xsd/name_clashes_and_references_B.xsd" />
<File path="../xsd/name_clashes_and_references_C.xsd" />
<File path="../xsd/simpletype_base.xsd" />
<File path="../xsd/type_substitution.xsd" />
<File path="../xsd/type_substitution_chain.xsd" />
......
......@@ -2627,7 +2627,7 @@ group Elements{
}
testcase tc_name_clashes_and_references_merged() runs on xmlTest_CT { // bug 541748
f_shellCommandWithVerdict(xsd2ttcn_command & " -o name_clashes_and_references_A.xsd name_clashes_and_references_B.xsd",
f_shellCommandWithVerdict(xsd2ttcn_command & " -o name_clashes_and_references_A.xsd name_clashes_and_references_B.xsd name_clashes_and_references_C.xsd",
"", c_shell_successWithoutWarningAndError);
if(getverdict == pass) {
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2000-2018 Ericsson Telecom AB
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
Contributors:
Baranyi, Botond
-->
<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema" xmlns = "http://somewhere.com/C" targetNamespace = "http://somewhere.com/C" elementFormDefault = "qualified" version = "1.0">
<xsd:simpleType name = "SimpleType">
<xsd:restriction base = "xsd:string"/>
</xsd:simpleType>
</xsd:schema>
......@@ -281,7 +281,8 @@ void XSDName2TTCN3Name(const Mstring& in_str, const Mstring& in_namespace,
Free(tmpname);
tmpname = mprintf("%s_%d", qual_name.name.c_str(), counter);
for (QualifiedNames::iterator used = used_names.begin(); used; used = used->Next) {
if (QualifiedName(/* empty_string ? */ ns_uri, Mstring(tmpname)) == used->Data) {
if ((!o_flag_used && QualifiedName(/* empty_string ? */ ns_uri, Mstring(tmpname)) == used->Data) ||
(o_flag_used && Mstring(tmpname) == used->Data.name)) {
found = true;
break;
}
......
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