Commit aeb2e5bb authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

xsd2ttcn: allow defaultForEmpty for enumerated restricted NMTOKENS, IDREFS (Bug 526506)



Change-Id: I6904cf27e05126fe33e45aab4bea4dc347bfecce
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent ccc50db1
......@@ -44,6 +44,18 @@ module www_example_org_enumeration_restriction {
import from XSD all;
const NMTOKENSEnumeration c_defaultForEmpty_1 := false_;
const IDREFSEnumeration c_defaultForEmpty_2 := false_;
const NMTOKENSEnumType c_defaultForEmpty_3 := false_;
const IDREFSEnumType c_defaultForEmpty_4 := false_;
type E21unnamed_type E21unnamed
with {
variant "name as uncapitalized";
......@@ -224,11 +236,67 @@ type record Element
}
with {
variant "element";
variant (modal) "defaultForEmpty as c_defaultForEmpty_1";
variant (modal) "attribute";
variant (modal2) "defaultForEmpty as c_defaultForEmpty_2";
variant (modal2) "attribute";
};
type NMTOKENSEnumType NMTOKENSEnumElem
with {
variant "defaultForEmpty as c_defaultForEmpty_3";
variant "element";
};
type enumerated NMTOKENSEnumType
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
};
type NMTOKENSType NMTOKENSElem
with {
variant "element";
};
type XSD.NMTOKENS NMTOKENSType;
type IDREFSEnumType IDREFSEnumElem
with {
variant "defaultForEmpty as c_defaultForEmpty_4";
variant "element";
};
type enumerated IDREFSEnumType
{
false_,
true_
}
with {
variant "text 'false_' as 'false'";
variant "text 'true_' as 'true'";
};
type IDREFSType IDREFSElem
with {
variant "element";
};
type XSD.IDREFS IDREFSType;
}
with {
encode "XML";
......
......@@ -167,4 +167,36 @@
</xs:complexType>
</xs:element>
<xs:element name="NMTOKENSEnumElem" type="this:NMTOKENSEnumType" default="false"/>
<xs:simpleType name="NMTOKENSEnumType">
<xs:restriction base="xs:NMTOKENS">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="NMTOKENSElem" type="this:NMTOKENSType" default="false"/>
<xs:simpleType name="NMTOKENSType">
<xs:restriction base="xs:NMTOKENS"/>
</xs:simpleType>
<xs:element name="IDREFSEnumElem" type="this:IDREFSEnumType" default="false"/>
<xs:simpleType name="IDREFSEnumType">
<xs:restriction base="xs:IDREFS">
<xs:enumeration value="true"/>
<xs:enumeration value="false"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="IDREFSElem" type="this:IDREFSType" default="false"/>
<xs:simpleType name="IDREFSType">
<xs:restriction base="xs:IDREFS"/>
</xs:simpleType>
</xs:schema>
......@@ -108,8 +108,11 @@ void Constant::finalModification() {
type.upload(newtype);
}
// Theese types do not support enumeration restriction
if (tmp_type == "NMTOKENS" || tmp_type == "IDREFS" || tmp_type == "ENTITIES") {
// These types do not support enumeration restriction
if (!(parent->getEnumeration().modified ||
(parent->getReference().get_ref() != NULL &&
((SimpleType*)(parent->getReference().get_ref()))->getEnumeration().modified))
&& (tmp_type == "NMTOKENS" || tmp_type == "IDREFS" || tmp_type == "ENTITIES")) {
// These are not supported by TITAN.
// Reset the default value and fixed value
parent->getValue().default_value = "";
......
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