56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
// import fs from "fs";
|
|
// import {XMLParser} from "fast-xml-parser";
|
|
// //const xmlData = fs.readFileSync('C:\\Users\\adm_matthes01\\Desktop\\Setup.xml', 'utf8');
|
|
|
|
// // Read the XML file as a string
|
|
// const xmlData = fs.readFileSync("C:\\Users\\adm_matthes01\\Desktop\\Setup.xml", "utf8");
|
|
|
|
// // Create a parser instance with options
|
|
// const parser = new XMLParser({
|
|
// ignoreAttributes: false, // Keep attributes in JSON
|
|
// attributeNamePrefix: "@_", // Prefix for attributes
|
|
// allowBooleanAttributes: true,
|
|
// trimValues: true,
|
|
// parseTagValue: true,
|
|
// parseAttributeValue: true,
|
|
// });
|
|
|
|
// // Parse the XML into a JSON object
|
|
// const jsonObj = parser.parse(xmlData);
|
|
|
|
// // Convert JSON object to a formatted string
|
|
// const jsonString = JSON.stringify(jsonObj.clsAGVManagerProject.ParkingList, null, 2);
|
|
|
|
// // Write the JSON to a file
|
|
// fs.writeFileSync("large.json", jsonString, "utf8");
|
|
|
|
// console.log("JSON saved to large.json");
|
|
|
|
// fs.readFile("large.json", "utf8", (err, data) => {
|
|
// if (err) {
|
|
// console.error(err);
|
|
// return;
|
|
// }
|
|
// const json = JSON.parse(data);
|
|
// //console.log(JSON.stringify(json[0].RowList, null, 2));
|
|
|
|
// const rowUpates = [];
|
|
// const updates = json.clsParking.map((i) => {
|
|
// // i.RowList.clsParkingRow.map(r =>{
|
|
// // rowUpates.push({id: r.Id, CustomerKey: r.CustomerKey})
|
|
// // })
|
|
// //console.log({id: i.Id,name: i. Name, lanes: i.RowList.clsParkingRow })
|
|
// rowUpates.push({id: i.Id, name: i.Name, lanes: i.RowList.clsParkingRow});
|
|
// });
|
|
// //console.log(Object.keys(json.clsAGVManagerProject.PalletCardConfigList. ParkingList.clsParking));
|
|
|
|
// //console.log(rowUpates)
|
|
// for (var i = 0; i <= 1; i++) {
|
|
// const laneID = {ID_ROW: rowUpates[i].lanes};
|
|
|
|
// if (laneID) {
|
|
// console.log(laneID.Id);
|
|
// }
|
|
// }
|
|
// });
|