add automatic saving of properties containing XML data
This commit is contained in:
@@ -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` });
|
||||||
|
|||||||
Reference in New Issue
Block a user