Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Vlatko
Contributor
Contributor

Wrong data types when importing xml structure from xsd files - Date imported as Object

Hi

I import XML structure from XSD files.

The problem is that datetime elements from XSD's are imported as data type Object. Why?

I have to import many different XML structures into my metadata, so I would like to import them without need for manual editing of the columns.

Best regards

Vlatko

Labels (3)
8 Replies
Anonymous
Not applicable

Hello,

We are supposing that you have already referred to this online documentation about: TalendHelpCenter: Uploading an XSD file

Is your XSD input file valid?

Could you please give us some sample content of structure and element data types of your XSD input?

Best regards

Sabrina

Vlatko
Contributor
Contributor
Author

Hello and thanks for your answer!

 

Yes, I have read the documentation for uploading an XSD file (by the way, I have not noticed any difference in the process compared to import of xml structures from XML-files).

 

Here are some date elements which are dateTime, but imported as Object in Talend:

 

<xs:element name="TidspunktSubmit">

<xs:simpleType>

<xs:union memberTypes="xs:dateTime">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:pattern value=""/>

</xs:restriction>

</xs:simpleType>

</xs:union>

</xs:simpleType>

</xs:element>

 

<xs:element name="MeldeDato">

<xs:simpleType>

<xs:union memberTypes="xs:date">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:pattern value=""/>

</xs:restriction>

</xs:simpleType>

</xs:union>

</xs:simpleType>

</xs:element>

 

<xs:element name="DatoMetastaser">

<xs:simpleType>

<xs:union memberTypes="xs:date">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:pattern value=""/>

</xs:restriction>

</xs:simpleType>

</xs:union>

</xs:simpleType>

</xs:element>

 

 

Vlatko
Contributor
Contributor
Author

0695b00000IdS3XAAV.jpg

Anonymous
Not applicable

Hello,

Usually, the defined type in xsd should be parsed correctly with appropriate type when generate schema.

Have you tried to use an XPath (tXMLMap) to test to see if this issue still repro?

Could you please clarify in which Talend version/edition you are?

We met this issue before and it was fixed in

https://jira.talendforge.org/browse/TDI-26941

Best regards

Sabrina

Vlatko
Contributor
Contributor
Author

Hello

It's the newest version:

Version: 7.3.1

Build id: 20200219_1130

 

Both Open Studio and licensed version of Talend Studio.

 

The Jira case you refer to does not seem to be directly related to this problem. It's about the MDM tool, and it's not Object, but String...

 

I am not sure how do you think I could use tXMLMap to test?

In my case I have not used tXMLMap. I use tExtractXMLField in order to flatten XML messages.

Anyway, the problem shows already after importing of XSD files into metadata. Metadata shows Object all the places where Date is expected.

 

Best regards

Vlatko

tornilleiro
Contributor III
Contributor III

Hello,

 

Could that be that your XSD element definition is a <xs:union (link) and not a simple element like <xs:element name="startdate" type="xs:dateTime"/> (link)?

For union element definitions if Talend map them to and Object I think is ok. You can treat it as an object and parse it to date format in following step

 

Anonymous
Not applicable

Hello,

That is really good answer, have you thought of entering our competition?

https://community.talend.com/s/blog/aGn5b000000CaZw/getting-smart-about-talend-tip-of-the-day

Best regards

Sabrina

Vlatko
Contributor
Contributor
Author

Hi

Thanks for your answer tornilleiro!

Generally I would agree on your suggestion "For union element definitions if Talend map them to and Object I think is ok".

BUT, in this case it's only union with empty string. So I would definitely expect Talend to understand that datetime elements could be empty also.

That's why I did not try to change the XSD files and check this. And I don't even will try it, because it would not resolve my problem. In my case, we are talking about very many XSD files, delivered by another big department, it takes weeks for them to produce one. So, it's not comparable amount of work - i.e. it's still much easier for me to edit the xml metadata after importing and change Object to Date...

But of course, it would be nice for me if Talend fixed it itself. As I said to begin with, I would like to import them without need for manual editing of the columns.

 

Thank you both for your help!

 

Best regards

Vlatko