Home » Eclipse Projects » Eclipse Titan » xsd2ttcn on RFC5874(xsd2ttcn fails to convert the XSD in RFC 5874)
|
Re: xsd2ttcn on RFC5874 [message #1824247 is a reply to message #1824222] |
Fri, 10 April 2020 16:04 |
|
Hi Olaf,
-the first problem is that in RFC5261-patch-ops.xsd there is no target namespace declared, which does not correctly reflect the intentions :
as RFC5261-patch-ops.xsd is included in RFC5874-xcap-diff.xsd , both should use the same target namespace "urn:ietf:params:xml:ns:xcap-diff"
In lack of a target namespace specified, all elements are generated into a special "NoTargetNamespace" namespace, with no prefix (meaning that any reference
without a prefix should be looked up in this namespace - kind of a garbage dump of XML).
To rectify this , I have added a namespace declaration to RFC5261-patch-ops.xsd:
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="urn:ietf:params:xml:ns:xcap-diff"
targetNamespace="urn:ietf:params:xml:ns:xcap-diff"
elementFormDefault="qualified">
:
:
and prefixed all type references with ns1 (the prefix is arbitrary, but has to be consistent)
(see attached archive).
To maintain consistency, I had to prefix also in RFC5874-xcap-diff.xsd any reference to definitions from RFC5261-patch-ops.xsd or to itself.
At this stage, the converter generated the TTCN-3 files. However it does make a mistake when generating urn_ietf_params_xml_ns_xcap_diff.ttcn as revealed
by the below compilation error:
make
/home/james00/titan.core/Install/bin/compiler -L \
urn_ietf_params_xml_ns_xcap_diff.ttcn UsefulTtcn3Types.ttcn XSD.ttcn - urn_ietf_params_xml_ns_xcap_diff.ttcn UsefulTtcn3Types.ttcn XSD.ttcn
Notify: Parsing TTCN-3 module `urn_ietf_params_xml_ns_xcap_diff.ttcn'...
Notify: Parsing TTCN-3 module `UsefulTtcn3Types.ttcn'...
Notify: Parsing TTCN-3 module `XSD.ttcn'...
Notify: Checking modules...
urn_ietf_params_xml_ns_xcap_diff.ttcn: In TTCN-3 module `urn_ietf_params_xml_ns_xcap_diff':
urn_ietf_params_xml_ns_xcap_diff.ttcn:140.1-154.1: In type definition `Xcap_diff':
urn_ietf_params_xml_ns_xcap_diff.ttcn:144.2-153.20: In record field `sequence':
urn_ietf_params_xml_ns_xcap_diff.ttcn:145.3-151.17: In record field `sequence_list':
urn_ietf_params_xml_ns_xcap_diff.ttcn:145.3-151.3: In embedded type of record of:
urn_ietf_params_xml_ns_xcap_diff.ttcn:146.4-150.11: In record field `choice':
urn_ietf_params_xml_ns_xcap_diff.ttcn:147.5-25: In union field `document':
urn_ietf_params_xml_ns_xcap_diff.ttcn:173.1-206.1: In type definition `DocumentType':
urn_ietf_params_xml_ns_xcap_diff.ttcn:183.5-190.5: error: A type with EMBED-VALUES must be a sequence type. The first component of the sequence shall be SEQUENCE OF UTF8String and shall not be marked DEFAULT
urn_ietf_params_xml_ns_xcap_diff.ttcn:196.5-201.5: error: A type with EMBED-VALUES must be a sequence type. The first component of the sequence shall be SEQUENCE OF UTF8String and shall not be marked DEFAULT
As it turns out , a wrong order in DocumentType is generated:
type record DocumentType
{
XSD.String new_etag optional,
XSD.String previous_etag optional,
XSD.AnyURI sel,
record of XSD.String attr optional,
union {
EmptyType body_not_changed,
record of record {
union {
record {
Pos pos optional,
Xpath_add sel,
Type type_ optional,
record of XSD.String attr optional,
record of XSD.String embed_values_1,
record of XSD.String elem_list
} add,
record {
Xpath sel,
Ws ws optional,
record of XSD.String attr optional
} remove,
record {
Xpath sel,
record of XSD.String attr optional,
record of XSD.String embed_values_1,
XSD.String elem optional
} replace_,
XSD.String elem
} choice
} sequence_list
} choice optional
}
:
Luckily , that is simple to fix by restoring the correct order:
type record DocumentType
{
XSD.String new_etag optional,
XSD.String previous_etag optional,
XSD.AnyURI sel,
record of XSD.String attr optional,
union {
EmptyType body_not_changed,
record of record {
union {
record {
record of XSD.String embed_values_1, //has to be first!!!!
Pos pos optional,
Xpath_add sel,
Type type_ optional,
record of XSD.String attr optional,
record of XSD.String elem_list
} add,
record {
Xpath sel,
Ws ws optional,
record of XSD.String attr optional
} remove,
record {
record of XSD.String embed_values_1, //has to be first!!!
Xpath sel,
record of XSD.String attr optional,
XSD.String elem optional
} replace_,
XSD.String elem
} choice
} sequence_list
} choice optional
}
:
At this stage , the TTCN-3 files will compile. For the converter error, I will issue a trouble report.
The amended schemas and the generated and corrected TTCN-3 files are attached.
I hope this helps.
Best regards
Elemer
|
|
| |
Goto Forum:
Current Time: Mon Oct 07 23:55:48 GMT 2024
Powered by FUDForum. Page generated in 0.03932 seconds
|