Я пытаюсь проанализировать несколько файлов XML в папке и извлечь из каждого файла карту String, List.И у меня проблема с разделением значений.
// ### Пример структуры XML-файла
<fields>
<fullName>DandbCompanyId</fullName>
<trackFeedHistory>false</trackFeedHistory>
<type>Lookup</type>
</fields>
<fields>
<fullName>Description</fullName>
<trackFeedHistory>false</trackFeedHistory>
</fields>
<fields>
<fullName>DunsNumber</fullName>
<trackFeedHistory>false</trackFeedHistory>
</fields>
<fields>
<fullName>Fax</fullName>
<trackFeedHistory>false</trackFeedHistory>
</fields>
<fields>
<fullName>Industry</fullName>
<trackFeedHistory>false</trackFeedHistory>
<type>Picklist</type>
</fields>
<fields>
<fullName>IsCustomerPortal</fullName>
</fields>
<fields>
<fullName>IsPartner</fullName>
<trackFeedHistory>false</trackFeedHistory>
</fields>
<listViews>
<fullName>AllAccounts</fullName>
<filterScope>Everything</filterScope>
<label>All Accounts</label>
</listViews>
<listViews>
<fullName>MyAccounts</fullName>
<filterScope>Mine</filterScope>
<label>My Accounts</label>
</listViews>
// #### Это то, что у меня есть
String srcPath = this.args[0];
def objFolder = new File(srcPath + '/objects')
if(!objFolder || !objFolder.isDirectory()) {
println " #### ERROR: ${objFolder} doesn't exist or is not a folder"
return
} else {
println " #### Path is correct! Checking objects"
}
def objMap = [:]
def xs = new XmlSlurper()
objFolder.eachFile { file ->
objMap.put(file.getName().split("\\.")[0], xs.parse(file).fields.fullName.each{
it.@fullName
})
};
objMap.each { k,v -> println v}
// ### И это вывод
DescriptionIsAlohaSupportedIsLightningSupportedNameOwnerIdStartingContext
IndustryOwnership
AllocationIdAmountBudgetIdChannelPartnerIdDescriptionOwnerIdRequestIdStatusTitle
ScorecardIdTargetEntityId
ActivityAllocationIdAmountBudgetIdCampaignIdChannelPartnerIdDescriptionDesiredOutcomeOwnerIdRequestedAmountStatusTitleTotalApprovedFcsTotalReimbursedFcs
CategoriesStatus
CapturedAngleContentDocumentIdImageAlternateTextImageClassImageClassObjectTypeImageTitleImageUrlImageViewTypeIsActiveName
Role
В результате я стремлюсь достичь:
locationId, Amount, BudgetId, Channel
Таким образом, он должен выглядеть как список строк (на карте это будет значение)