Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Issues with xsd2ttcn(TTCN-3 XSD xsd2ttcn)
Issues with xsd2ttcn [message #1791539] Mon, 02 July 2018 08:30 Go to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Dear Elemer,

I got some issues trying to generate TTCN-3 files from XSD files (see attached xsd.tar.bz2 file), using xsd2ttcn tool.
When generating TTCN-3 files, it seems that some imports were missing.
I tried to add them manually, but I got TTCN-3 compiler errors at the end.

May I ask you your help to fix it, please?

Many thanks in advance,

Yann

  • Attachment: xsd.tar.bz2
    (Size: 6.79KB, Downloaded 66 times)
Re: Issues with xsd2ttcn [message #1791546 is a reply to message #1791539] Mon, 02 July 2018 11:22 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,

indeed , when I run xsd2ttcn over your files, results in:

xsd2ttcn *.xsd
Notify: Checking documents...
Notify: Parsing XML schema document `GML-pidf-lo-shape.xsd'...
Notify: Parsing XML schema document `RFC3863_pidf.xsd'...
Notify: Parsing XML schema document `RFC4119_geopriv10.xsd'...
Notify: Parsing XML schema document `RFC4119_geopriv10_basic_policy.xsd'...
Notify: Parsing XML schema document `RFC4119_geopriv10_civiloc.xsd'...
Notify: Parsing XML schema document `RFC5985_held.xsd'...
Notify: Parsing XML schema document `RFC6155_held_id.xsd'...
Notify: Parsing XML schema document `RFC7459_pidf_lo.xsd'...
Notify: Parsing XML schema document `basicTypes.xsd'...
Notify: Parsing XML schema document `geometryBasic0d1d.xsd'...
Notify: Parsing XML schema document `geometryBasic2d.xsd'...
Notify: Parsing XML schema document `geometryPrimitives.xsd'...
Notify: Parsing XML schema document `gmlBase.xsd'...
Notify: Parsing XML schema document `measures.xsd'...
Notify: Parsing XML schema document `xml_2001.xsd'...
I/O error : Attempt to load network entity http://www.w3.org/2001/xml.xsd
WARNING:
RFC3863_pidf.xsd (in line 10): Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/2001/xml.xsd'. Skipping the import.
I/O error : Attempt to load network entity http://www.w3.org/2001/xml.xsd
WARNING:
RFC4119_geopriv10.xsd (in line 12): Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/2001/xml.xsd'. Skipping the import.
I/O error : Attempt to load network entity http://www.w3.org/2001/xml.xsd
WARNING:
RFC4119_geopriv10_basic_policy.xsd (in line 9): Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/2001/xml.xsd'. Skipping the import.
WARNING:
RFC3863_pidf.xsd (in type Qvalue): Pattern restriction is not supported on type 'decimal'.
Notify: Generating TTCN-3 modules...
Notify: File 'http_www_opengis_net_gml.ttcn' was generated.
Notify: File 'http_www_opengis_net_pidflo_1_0.ttcn' was generated.
Notify: File 'http_www_w3_org_XML_1998_namespace.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_conf.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_held.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_held_id.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf_geopriv10.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf_geopriv10_basicPolicy.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf_geopriv10_civicLoc.ttcn' was generated.
Notify: File 'UsefulTtcn3Types.ttcn' was generated.
Notify: File 'XSD.ttcn' was generated.
Notify: No errors and 4 warnings were detected.



Note though that only warnings are issued and the *.ttcn files are generated.


Now if we look into the warning:
RFC3863_pidf.xsd (in line 10): Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'http://www.w3.org/2001/xml.xsd'. Skipping the import.


this only means that the converter cannot follow links or hyperlinks, all XSD's have to be present and located in the same directory. Import links and hyperlinks will have to be replaced with a direct local reference.


In this case , all

	 <xs:import namespace="http://www.w3.org/XML/1998/namespace"
     schemaLocation="http://www.w3.org/2001/xml.xsd"/>



are to be replaced with:

	 <xs:import namespace="http://www.w3.org/XML/1998/namespace"
     schemaLocation="xml_2001.xsd"/>


With this done,
one warning remains:

RFC3863_pidf.xsd (in type Qvalue): Pattern restriction is not supported on type 'decimal'.


which is kinda self-explanatory.

Commenting out the offending code:
<xs:simpleType name="qvalue">
  <xs:restriction base="xs:decimal">
    <!-- xs:pattern value="0(.[0-9]{0,3})?"/>
    <xs:pattern value="1(.0{0,3})?"/ !-->
  </xs:restriction>
</xs:simpleType>


will get rid of this warning too.


See attached archive.

Best regards
Elemer
  • Attachment: xml.tgz
    (Size: 16.78KB, Downloaded 78 times)
Re: Issues with xsd2ttcn [message #1791554 is a reply to message #1791546] Mon, 02 July 2018 13:01 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Elemer,

Houla, I missed the issue with the pattern, For XSD, I agree, it was provided by the LibSip.
Unfortunately, some imports seems to be missing: I got this error:
../ttcn/http_www_opengis_net_gml.ttcn:900.2-10: error: There is no local or imported definition with name `Ellipsoid'

Thanks a lot.

Yann
Re: Issues with xsd2ttcn [message #1791555 is a reply to message #1791554] Mon, 02 July 2018 13:03 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Elemer,

Houlala, I missed the issue with the pattern, for XSD, I agree, it was provided by the LibSip.
Unfortunately, some imports seems to be missing: I got this error:
../ttcn/http_www_opengis_net_gml.ttcn:900.2-10: error: There is no local or imported definition with name `Ellipsoid'

Thanks a lot.

Yann
Re: Issues with xsd2ttcn [message #1791560 is a reply to message #1791555] Mon, 02 July 2018 13:29 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,

the definition of Ellipsoid is there, both in .xsd and .ttcn:

grep llipsoid *.xsd
GML-pidf-lo-shape.xsd:    <xs:element name="Ellipsoid" type="gs:EllipsoidType"
GML-pidf-lo-shape.xsd:    <xs:complexType name="EllipsoidType">
esekilxxen1845 [15:23] [YannGarcia/XSD@TTCN/xsd] ->
esekilxxen1845 [15:23] [YannGarcia/XSD@TTCN/xsd] ->
esekilxxen1845 [15:23] [YannGarcia/XSD@TTCN/xsd] -> grep llipsoid *.ttcn
http_www_opengis_net_gml.ttcn:  Ellipsoid ellipsoid,
http_www_opengis_net_gml.ttcn:  variant (ellipsoid) "name as capitalized";
http_www_opengis_net_pidflo_1_0.ttcn:type EllipsoidType Ellipsoid
http_www_opengis_net_pidflo_1_0.ttcn:type record EllipsoidType




but it's not imported:

module http_www_opengis_net_gml {


import from XSD all;
:

:




try to add "import from http_www_opengis_net_pidflo_1_0.ttcn all"

to http_www_opengis_net_gml.ttcn

BR

Elemer

Re: Issues with xsd2ttcn [message #1791623 is a reply to message #1791560] Tue, 03 July 2018 06:22 Go to previous messageGo to next message
Yann Garcia is currently offline Yann GarciaFriend
Messages: 145
Registered: June 2016
Senior Member
Hello Elemer,

Yes, I did it, but in this case, I got a cyclic import between http_www_opengis_net_gml.ttcn and http_www_opengis_net_pidflo_1_0.ttcn.
When the C++ code is generated, I got errors while compiling http_www_opengis_net_gml.cc beacause of http_www_opengis_net_pidflo_1_0.hh not included in http_www_opengis_net_gml.hh

I attached the generated files. The file out.txt is the output of the make (make > out.txt 2>&1).

Thanks again for your help,

Yann
  • Attachment: objs.tar.bz2
    (Size: 5.35MB, Downloaded 71 times)
Re: Issues with xsd2ttcn [message #1791651 is a reply to message #1791623] Tue, 03 July 2018 10:23 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann, you're right ,

there's a glitch, we are looking into it.

Some structures are generated into http_www_opengis_net_gml.ttcn

instead of http_www_opengis_net_pidflo_1_0.ttcn

I have moved them to their right place and then it compiles ( see attached)

I'll come back to you.


BR

Elemer


Re: Issues with xsd2ttcn [message #1792335 is a reply to message #1791651] Mon, 16 July 2018 08:38 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,


ok , here's the update on this issue:

the problem is that in such cases the converter generates definitions in the wrong file.
As a countermeasure we have introduced a switch -o which will have to effect to force generation of single TTCN file with a set name XSD_Definitions.ttcn , not one file per namespace
as without the -o switch.

Namespaces are separated in groups though.

 xsd2ttcn -o *.xsd          
Notify: Checking documents...                                                  
Notify: Parsing XML schema document `GML-pidf-lo-shape.xsd'...                 
Notify: Parsing XML schema document `RFC3863_pidf.xsd'...                      
Notify: Parsing XML schema document `RFC4119_geopriv10.xsd'...                 
Notify: Parsing XML schema document `RFC4119_geopriv10_basic_policy.xsd'...    
Notify: Parsing XML schema document `RFC4119_geopriv10_civiloc.xsd'...         
Notify: Parsing XML schema document `RFC5985_held.xsd'...                      
Notify: Parsing XML schema document `RFC6155_held_id.xsd'...                   
Notify: Parsing XML schema document `RFC7459_pidf_lo.xsd'...                   
Notify: Parsing XML schema document `basicTypes.xsd'...                        
Notify: Parsing XML schema document `geometryBasic0d1d.xsd'...                 
Notify: Parsing XML schema document `geometryBasic2d.xsd'...                   
Notify: Parsing XML schema document `geometryPrimitives.xsd'...                
Notify: Parsing XML schema document `gmlBase.xsd'...                           
Notify: Parsing XML schema document `measures.xsd'...                          
Notify: Parsing XML schema document `xml_2001.xsd'...                          
Notify: Generating TTCN-3 modules...                                           
Notify: File 'XSD_Definitions.ttcn' was generated.                             
Notify: File 'UsefulTtcn3Types.ttcn' was generated.                            
Notify: File 'XSD.ttcn' was generated.                              


This fix has been committed to github, could you please test it?

Thank you and regards
Elemer







Re: Issues with xsd2ttcn [message #1792338 is a reply to message #1792335] Mon, 16 July 2018 09:02 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Yann,

in fact if this option is used in a smart way, the advantage of generating one file per namespace can be retained:

If you look at the import/include dependencies you can see that your package contains two sets of files that are unconnected so we can convert them in two steps:

xsd2ttcn -o basicTypes.xsd gmlBase.xsd measures.xsd geometryBasic0d1d.xsd geometryBasic2d.xsd geometryPrimitives.xsd GML-pidf-lo-shape.xsd 
Notify: Checking documents...
Notify: Parsing XML schema document `basicTypes.xsd'...
Notify: Parsing XML schema document `gmlBase.xsd'...
Notify: Parsing XML schema document `measures.xsd'...
Notify: Parsing XML schema document `geometryBasic0d1d.xsd'...
Notify: Parsing XML schema document `geometryBasic2d.xsd'...
Notify: Parsing XML schema document `geometryPrimitives.xsd'...
Notify: Parsing XML schema document `GML-pidf-lo-shape.xsd'...
Notify: Generating TTCN-3 modules...
Notify: File 'XSD_Definitions.ttcn' was generated.
Notify: File 'UsefulTtcn3Types.ttcn' was generated.
Notify: File 'XSD.ttcn' was generated.



xsd2ttcn xml_2001.xsd RFC3863_pidf.xsd RFC4119_geopriv10_basic_policy.xsd RFC4119_geopriv10.xsd RFC5985_held.xsd RFC6155_held_id.xsd RFC7459_pidf_lo.xsd
Notify: Checking documents...
Notify: Parsing XML schema document `xml_2001.xsd'...
Notify: Parsing XML schema document `RFC3863_pidf.xsd'...
Notify: Parsing XML schema document `RFC4119_geopriv10_basic_policy.xsd'...
Notify: Parsing XML schema document `RFC4119_geopriv10.xsd'...
Notify: Parsing XML schema document `RFC5985_held.xsd'...
Notify: Parsing XML schema document `RFC6155_held_id.xsd'...
Notify: Parsing XML schema document `RFC7459_pidf_lo.xsd'...
Notify: Generating TTCN-3 modules...
Notify: File 'http_www_w3_org_XML_1998_namespace.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_conf.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_held.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_geopriv_held_id.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf_geopriv10.ttcn' was generated.
Notify: File 'urn_ietf_params_xml_ns_pidf_geopriv10_basicPolicy.ttcn' was generated.
Notify: File 'UsefulTtcn3Types.ttcn' was generated.
Notify: File 'XSD.ttcn' was generated.



The result will compile.

see generated files in the attached archive.

BR

Elemer

Previous Topic:xsd2ttcn and Relax NG schema
Next Topic:Problem with duplicate incoming message type boolean
Goto Forum:
  


Current Time: Thu Apr 25 20:22:40 GMT 2024

Powered by FUDForum. Page generated in 0.03381 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top