That's not a great title..sorry! It's quite hard to explain this one!
Let's say I've got the following XML for a single record (records are split at \ecatalogue\tuple)
<ecatalogue name="ecatalogue">
<tuple>
<irn>80489</irn>
<ColMainTitle>Henning, Ritchie & Hill.</ColMainTitle>
<ColObjectNumber>ALB-24-70</ColObjectNumber>
<ColObjectStatus>2- Direct supervision</ColObjectStatus>
<ConConsObjectType/>
<EADLevelAttribute/>
<PhoRecordLevel>Item</PhoRecordLevel>
<SecRecordStatus>Active</SecRecordStatus>
<PhoRecordStatus>Complete</PhoRecordStatus>
<ColArtistNameRef_tab name="ColArtistNameRef_tab">
<tuple>
<irn>40</irn>
<NamFirst/>
<NamFullName>David Octavius Hill & Robert Adamson</NamFullName>
<NamLast/>
<NamTitle/>
<BioBirthDate>1843</BioBirthDate>
<BioDeathDate>1847</BioDeathDate>
<AddPhysCity/>
<AddPhysCountry/>
<NamPartyType>Organisation</NamPartyType>
<NamOrganisation>David Octavius Hill & Robert Adamson</NamOrganisation>
</tuple>
<tuple>
<irn>13609</irn>
<NamFirst>David</NamFirst>
<NamFullName>David O. Hill</NamFullName>
<NamLast>Hill</NamLast>
<NamTitle/>
<BioBirthDate>20/May/1802</BioBirthDate>
<BioDeathDate>1870</BioDeathDate>
<AddPhysCity/>
<AddPhysCountry/>
<NamPartyType>Person</NamPartyType>
<NamOrganisation>Hill & Adamson</NamOrganisation>
</tuple>
</ColArtistNameRef_tab>
</tuple>
</ecatalogue>
I want to keep the child elements of each ColArtistNameRef_tab tuple together so i can then reference the child elements together within the FTL.
At the moment each child element is mapped to separate classes (i.e BioBirthDate is mapped to "DOB"), but the result is that these child elements are just flattly attached to the returned record. This is a problem when not all the child elements have values, so i can't even reference the index of one list to output the correct position on another list (if that makes sense!!).
Is there a way to map a class to the parent element ColArtistNameRef_tab tuple (/ecatalogue/tuple/ColArtistNameRef_tab/tuple) which groups the child elements to that class, making them usable in FTL?
I.e map "Artist" to "ecatalogue/tuple/ColArtistNameRef_tab/tuple",
then in FTL, do something like this?
<#assign artist = s.result.listMetadata['Artist']!"null"/>
<#list artist as a>
${a.NamFirst} ${a.NamLast}
</#list>
etc
I've tried mapping "ecatalogue/tuple/ColArtistNameRef_tab/tuple" to a class, but it just shows as 0 matching documents. I've also tried some fancier XPATH mapping such as "/ecatalogue/tuple/ColArtistNameRef_tab/child::*" but that also has zero matching documents.
Any advice would be greatly received! Thanks!
created
Feb '20
last reply
Feb '20
- 2
replies
- 3.6k
views
- 2
users