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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

handling of schema dynamically

hello all..

i need to convert xml file to json and insert that into maprdb. How can I handle schema dynamically in that.

Suppose my XML has 10 fields and most of the time  3 ,4  field contains null values so in that case i just want to store rest fields having values  and i don't want to store all 10 fields.But in some time all the fields have values and there is need to store all the fields.

So to avoid wastage of space i just want to save the fields having some value other then null.Can in do this in talend? 

Labels (5)
4 Replies
Jesperrekuh
Specialist
Specialist

Hi 

 

There's a component to convert from XML to JSON

https://exchange.talend.com/#marketplaceproductoverview:marketplace=marketplace%252F1&p=marketplace%...

 

Sidenote, basics Document type which you easily can convert to json i assumen... 

 

Good Luck

Anonymous
Not applicable
Author

hello..

I am able to change xml to json that is not the problem for me.

I want to handle schema dynamically. Like if 4 columns have value that 4 columns should be stored in maprdb and if 7 columns have values than 7 columns should be stored.

Anonymous
Not applicable
Author

@shalla - not entirely sure on your use case. But I can think of an approach: If your input would have been a delimited , the solution would hav ebeen lil different For XML ------ Option 1 pick up the maximum possibility hierarchial xml schema file and use as input. tXMLInput (xpath is just "/" -> tXMLMap -> Map all fields to right -> use tJavarow like to filter out or write conditions -> flatten out the file -> arrange back to JSON. Options 2 I have never tried data type as Dynamic with XML type , give it a try. For delimited dynamic data type schema works perfectly fine. only available in enterprise not TOS.
Anonymous
Not applicable
Author

@snayak thanku for your response . I will try try that.I am using enterprise.

My use case is dynamically handle the schema in terms of number of columns.Some time xml file has all 30 fields and some time 30-N .