add automatic saving of properties containing XML data

This commit is contained in:
2026-05-14 09:42:43 +02:00
parent 845e777f08
commit 80784fb47a
+8
View File
@@ -486,6 +486,14 @@ async function processArrayProperty(outputPath, propertyName, arr) {
} else if (typeof item === 'object' && item !== null) { } else if (typeof item === 'object' && item !== null) {
fileInfo = await saveJsonProperty(dirPath, itemName, item); fileInfo = await saveJsonProperty(dirPath, itemName, item);
indexData.itemTypes.push({ index: originalIndex, type: 'json', fileName: `${itemName}.json` }); indexData.itemTypes.push({ index: originalIndex, type: 'json', fileName: `${itemName}.json` });
// Additional processing for some items (e.g. extract XML from strings inside objects)
for (const [key, value] of Object.entries(item)) {
if (typeof value === 'string' && isXmlContent(value)) {
const xmlFileName = `${itemName}_${key}`;
const xmlFileInfo = await saveStringProperty(dirPath, xmlFileName, value);
result.files.push(xmlFileInfo.filepath);
}
}
} else { } else {
fileInfo = await saveJsonProperty(dirPath, itemName, item); fileInfo = await saveJsonProperty(dirPath, itemName, item);
indexData.itemTypes.push({ index: originalIndex, type: typeof item, fileName: `${itemName}.json` }); indexData.itemTypes.push({ index: originalIndex, type: typeof item, fileName: `${itemName}.json` });