cancel
Showing results for 
Search instead for 
Did you mean: 

XML Generator Template Issues

mike_korcynski
New Contributor III

I’m trying to use a XML Generating template to bind some JSON to XML. It looks like it should work to me but it never binds correctly. I’ve simplified the template down just to the piece that is failing. The input JSON looks like :

[{"import-record":{"@type-name":"mentoring","native":{"field":[{"@type":"person-list","@name":"c-advisee","people":[{"person":{"last-name":"Ouyang","first-names":"Mengyao"}},{"person":{"last-name":"Liu","first-names":"Jingyi"}},{"person":{"last-name":"Giannakakis","first-names":"Georgios"}},{"person":{"last-name":"Cao","first-names":"Sufeng"}},{"person":{"last-name":"Fiedler","first-names":"Jacob S."}}]}]}}}]

And my template looks like:

<?xml version='1.0' encoding='UTF-8'?>
<import-record type-id="$import-record.at-type-id" type-name="$import-record.at-type-name">
    <native>#foreach($field in $import-record.native.field)
        <field name="$field.at-name">
            <people>#foreach($person in $field.people.person)
                <person>
                    <links>#foreach($link in $person.links.link)
                        <link type="$link.at-type" privacy="$link.at-privacy" href="$link.at-href" id="$link.at-id"/>#end
                    </links>
                    <last-name>$person.last-name</last-name>
                    <initials>$person.initials</initials>
                    <first-names>$person.first-names</first-names>
                    <addresses>#foreach($address in $person.addresses.address)
                        <address type="$address.at-type" iso-country-code="$address.at-iso-country-code">#foreach($line in $address.line)
                            <line type="$line.at-type">$line.value</line>#end
                            <grid href="$address.grid.at-href" longitude="$address.grid.at-longitude" latitude="$address.grid.at-latitude" id="$address.grid.at-id"/>
                        </address>#end
                    </addresses>
                    <email-address>$person.email-address</email-address>
                    <identifiers>#foreach($identifier in $person.identifiers.identifier)
                        <identifier scheme="$identifier.at-scheme">$identifier.value</identifier>#end
                    </identifiers>
                </person>#end
            </people>
        </field>#end
    </native>
</import-record>

Pipeline sequence is:

00

The output out of XML Generator is:

"xml": "<?xml version="1.0" encoding="UTF-8"?><import-record type-name="mentoring"><native> <field name="c-advisee"><people> </people></field> </native></import-record>"

I don’t understand given the template and the data why the values are not populating?

5 REPLIES 5

Please show us your settings and the error you’re getting.