diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_defaultforempty_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_defaultforempty_e.ttcn index 1fd51311142e58f320508e9e180a78d26e9128f1..fd22228c3c58062b6e4e8722356f8de5b1dbfe94 100644 --- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_defaultforempty_e.ttcn +++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_defaultforempty_e.ttcn @@ -322,7 +322,7 @@ with { }; -/* Unsupported anytype and QName */ +/* Unsupported anytype and QName and IDREFS and ENTITIES and NMTOKENS */ type XSD.AnyType AnyTypeDefault @@ -361,6 +361,30 @@ with { }; +type XSD.IDREFS IDREFSDefault +with { + variant "element"; +}; + + +type XSD.IDREFS IDREFSFixed +with { + variant "element"; +}; + + +type XSD.NMTOKENS NMTOKENSDefault +with { + variant "element"; +}; + + +type XSD.NMTOKENS NMTOKENSFixed +with { + variant "element"; +}; + + /* Check if the name conversion follows to the constants too */ diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn index 734ae7166fd7753716eea6373f9620ab96d04848..883703f9f6d73137a4e5b4a94236eae6fbd99595 100644 --- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn +++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn @@ -116,6 +116,36 @@ with { }; +type enumerated NMTokens +{ + vxmlcurrency, + vxmldate, + vxmldigits, + vxmlnumber, + vxmltime +} +with { + variant "text 'vxmlcurrency' as 'vxml:currency'"; + variant "text 'vxmldate' as 'vxml:date'"; + variant "text 'vxmldigits' as 'vxml:digits'"; + variant "text 'vxmlnumber' as 'vxml:number'"; + variant "text 'vxmltime' as 'vxml:time'"; +}; + + +type enumerated IDRefs +{ + nmtokens_ref, + qname_ref +}; + + +/* Still unsupported QName */ + + +type XSD.QName QName; + + } with { encode "XML"; diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn index 2f47ea7788f0f54724dd42ee3b6dbc8f569cd0ef..ef57f20dc33ea006e53d7128eb35cd6a15df5cd9 100644 --- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn +++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn @@ -195,10 +195,26 @@ with { }; -type XSD.NMTOKENS NMTOKENSEnumeration; +type enumerated NMTOKENSEnumeration +{ + false_, + true_ +} +with { + variant "text 'false_' as 'false'"; + variant "text 'true_' as 'true'"; +}; -type XSD.IDREFS IDREFSEnumeration; +type enumerated IDREFSEnumeration +{ + false_, + true_ +} +with { + variant "text 'false_' as 'false'"; + variant "text 'true_' as 'true'"; +}; type record Element diff --git a/regression_test/XML/XmlWorkflow/src/xmlTest_Testcases.ttcn b/regression_test/XML/XmlWorkflow/src/xmlTest_Testcases.ttcn index 446509d8b7afab4f3f6387861be9a3cd46c69c79..59f8c9b1081a062f41fc7108491a6e9e34ccc9c2 100644 --- a/regression_test/XML/XmlWorkflow/src/xmlTest_Testcases.ttcn +++ b/regression_test/XML/XmlWorkflow/src/xmlTest_Testcases.ttcn @@ -1113,7 +1113,7 @@ group UnionTest { testcase tc_enumeration_union_restriction() runs on xmlTest_CT { - f_shellCommandWithVerdict(xsd2ttcn_command & " enumeration_restriction.xsd","",c_shell_successWithWarning) + f_shellCommandWithVerdict(xsd2ttcn_command & " enumeration_restriction.xsd","",c_shell_successWithoutWarningAndError) if(getverdict==pass) { f_compareFiles( @@ -1135,7 +1135,7 @@ group UnionTest { testcase tc_enumeration_restriction3() runs on xmlTest_CT { - f_shellCommandWithVerdict(xsd2ttcn_command & " enumeration_restriction3.xsd","",c_shell_successWithoutWarningAndError) + f_shellCommandWithVerdict(xsd2ttcn_command & " enumeration_restriction3.xsd","",c_shell_successWithWarning) if(getverdict==pass) { f_compareFiles( diff --git a/regression_test/XML/XmlWorkflow/xsd/defaultforempty.xsd b/regression_test/XML/XmlWorkflow/xsd/defaultforempty.xsd index 3c7e072263878ebd2b478791de2c753c71fa0448..2e37831c63335a0034a4dc98718aa3305c1969df 100644 --- a/regression_test/XML/XmlWorkflow/xsd/defaultforempty.xsd +++ b/regression_test/XML/XmlWorkflow/xsd/defaultforempty.xsd @@ -53,7 +53,7 @@ <xs:element name='AnySimpleTypeFixed' type="xs:anySimpleType" fixed='1.0.0'/> -<!-- Unsupported anytype and QName --> +<!-- Unsupported anytype and QName and IDREFS and ENTITIES and NMTOKENS --> <xs:element name='AnyTypeDefault' default='1.0.0'/> <xs:element name='AnyTypeFixed' fixed='1.0.0'/> @@ -66,6 +66,14 @@ <xs:element name='QNameFixed' type="xs:QName" fixed='Name'/> +<xs:element name='IDREFSDefault' type="xs:IDREFS" id="my_id" default='my_id'/> + +<xs:element name='IDREFSFixed' type="xs:IDREFS" fixed='my_id'/> + +<xs:element name='NMTOKENSDefault' type="xs:NMTOKENS" default='abc'/> + +<xs:element name='NMTOKENSFixed' type="xs:NMTOKENS" fixed='abc'/> + <!-- Check if the name conversion follows to the constants too --> <xs:element name="AttrfixedMyString3_"/> <xs:element name="MyString_"/> diff --git a/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction3.xsd b/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction3.xsd index b2f1d215002e1e02512cb421d05a9cbe8569c659..c245f02190838e9de05c7b6d4d6b6539bb907625 100644 --- a/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction3.xsd +++ b/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction3.xsd @@ -52,5 +52,33 @@ </simpleContent> </complexType> +<simpleType name="NMTokens" id="nmtokens_ref"> + <restriction base="NMTOKENS"> + <enumeration value="vxml:digits"/> + <enumeration value="vxml:number"/> + <enumeration value="vxml:time"/> + <enumeration value="vxml:date"/> + <enumeration value="vxml:currency"/> + </restriction> +</simpleType> + +<simpleType name="IDRefs"> + <restriction base="IDREFS"> + <enumeration value="nmtokens_ref"/> + <enumeration value="qname_ref"/> + </restriction> +</simpleType> + + +<!-- Still unsupported QName --> +<simpleType name="QName" id="qname_ref"> + <restriction base="QName"> + <enumeration value="digits"/> + <enumeration value="number"/> + <enumeration value="time"/> + <enumeration value="date"/> + <enumeration value="currency"/> + </restriction> +</simpleType> </schema> diff --git a/xsdconvert/SimpleType.cc b/xsdconvert/SimpleType.cc index 6d605410f99b685913ca985b8f1f079646156488..d1ef38bbbccfe286c75180f55b41fbc0c86143af 100644 --- a/xsdconvert/SimpleType.cc +++ b/xsdconvert/SimpleType.cc @@ -1267,7 +1267,7 @@ void EnumerationType::applyFacets() // string types, integer types, float types, const Mstring & base = parent->getBuiltInBase(); - if (isStringType(base)) // here length restriction is applicable + if (isStringType(base) || (isSequenceType(base) && base != "QName")) // here length restriction is applicable { List<Mstring> text_variants; for (List<Mstring>::iterator facet = facets.begin(); facet; facet = facet->Next) { @@ -1370,7 +1370,7 @@ void EnumerationType::printToFile(FILE * file, unsigned int indent_level) const if (!modified) return; const Mstring & base = parent->getBuiltInBase(); - if (isStringType(base)) { + if (isStringType(base) || (isSequenceType(base) && base != "QName")) { for (QualifiedNames::iterator itemString = items_string.begin(); itemString; itemString = itemString->Next) { if (itemString != items_string.begin()) fputs(",\n", file); for (unsigned int l = 0; l != indent_level; ++l) fputs("\t", file); @@ -1634,8 +1634,8 @@ void ValueType::printToFile(FILE * file) const { if(!isBuiltInType(type)){ type = findBuiltInType(parent, type); } + const Mstring& name = type.getValueWithoutPrefix(':'); if (isStringType(type) || isTimeType(type) || isQNameType(type) || isAnyType(type)) { - const Mstring& name = type.getValueWithoutPrefix(':'); if (name != "hexBinary" && name != "base64Binary") { fprintf(file, " (\"%s\")", fixed_value.c_str()); } @@ -1652,7 +1652,7 @@ void ValueType::printToFile(FILE * file) const { } else if (isFloatType(type)) { Mstring val = xmlFloat2TTCN3FloatStr(fixed_value); fprintf(file, " (%s)", val.c_str()); - } else { + } else if (name != "NMTOKENS" && name != "IDREFS" && name != "ENTITIES"){ fprintf(file, " (%s)", fixed_value.c_str()); } }