Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML to MongoDB - Best Approach?

Objective: 
Read complex xml file, do some minor transformations, then load into existing mongodb collection.
Current Approach: 
Use tInputFileMSXML to flatten xml into multiple tHashOutputs (works fine), use tMap to do transformations and joining (works fine), construct output to load into Mongodb (here is the problem).  
Challenge (I think): 
I tried using the tWriteJsonField, but it does not support multiple loop elements.  How can I get the data into the structure needed to insert into MongoDB? I did search the forum (found that multiple loop elements are not support in Json related talend components), and reviewed every tutorial I could find on the internet, but none have complex XML examples. 
Any help would be appreciated.
XML Source (pseudo example):
    <Product name="Domesticated Animal Care Manuals">
        <Attributes>
            <Attrib name="Category">Care Manuals</Attrib>
            <Attrib name="Type">Domesticated Animals</Attrib>
        </Attributes>
        <Images>
            <Image name="bird photo">x2345.jpg</Image>
            <Image name="cat photo">x45678.jpg</Image>
            <Image name="dog photo">x5927.jpg</Image>
        </Images>
        <productPdfs>
            <Document name="Bird Care Manual">takecareofyourbird.pdf</Document>
            <Document name="Cat Care Manual">takecareofyourcat.pdf</Document>
            <Document name="Dog Care Manual">takecareofyourdog.pdf</Document>
        </productPdfs>
        <productPricing>
            <COG Type="EACH">
                <Attrib name="Our Cost">4</Attribute>
                <Attrib name="Retail Price">15.5</Attribute>
                <Attrib name="Sale Price">10</Attribute>
            </COG>
        </productPricing>
    </Product>
Desired Output 
Mongodb Collection Structure:
{"name":"Domesticated Animal Care Manuals","category":"Care Manuals","type":"Domesticated Animals","images":,"productPdfs":,"productPricing":}
0683p000009MEpY.jpg
Labels (4)
3 Replies
Anonymous
Not applicable
Author

Anyone out there that could help me, it would be greatly appreciated.
Anonymous
Not applicable
Author

I am willing to pay for support on this issue.  Are there any resources that could help me out?
Anonymous
Not applicable
Author

How did you manage to do this? 0683p000009MACn.png i want to load data into MongoDB ( more then 1 nested loop ) but I don't know how ..
I manage to fixe the 'multiple nested loop' issue by using tXMLmap but I don't know how to load this data in the MongoDB ...
Thanks