'Read failed for <filename> Details not well formed(invalid token)

I have been trying to parsing one xml file through npm package node-expat there certain xml file

<?xml version="1.0" encoding="utf-8"?><root><header><documentType>ItemFulfillment</documentType></header><record id="1"><Document_Number>IF0916382</Document_Number><Picked_Date>2022-05-06T16:45:04.543</Picked_Date><Reference_Number>IF0916382</Reference_Number><Item><Itemline><Item>GSW0145-GR02 : GSW0145-GR02-1/2</Item><OrderedQuantity>1.00000</OrderedQuantity><ShippedQuantity>1.00000</ShippedQuantity><UPC>019624238898</UPC></Itemline><Itemline><Item>GSW0144-GR02 : GSW0144-GR02-1/2</Item><OrderedQuantity>1.00000</OrderedQuantity><ShippedQuantity>1.00000</ShippedQuantity><UPC>019624272588</UPC></Itemline></Item><Packaging><PackageLine><Tracking_Number>1ZEW5167YW14791144</Tracking_Number><Weight>1.20000</Weight></PackageLine></Packaging><Shipping_Addressee>Katherine Hooks</Shipping_Addressee><Shipping_Address_1>815 Edwards Road</Shipping_Address_1><Shipping_Address_2>Unit 20</Shipping_Address_2><Shipping_City>Greenville</Shipping_City><Shipping_Country>US</Shipping_Country><Shipping_Zip>29615</Shipping_Zip><Shipping_State_Province>SC</Shipping_State_Province></record></root>

This files works in almost all cases but sometimes it fails.Getting following error Read failed for Details not well formed(invalid token)



Solution 1:[1]

You can check below npm package for parsing XML.

https://www.npmjs.com/package/fast-xml-parser

If you want to use you same npm package then please check the below image for your reference.enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1