NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.43k stars 297 forks source link

XML parse looks good on Online tool, but when using API crashes #648

Open hectorgrecco opened 3 months ago

hectorgrecco commented 3 months ago

Description

When I'm parsing a specific XML using the API, the package crashes and throws the error on the image. But, when I use the online validator, it does not. Whats happening?

Code

const options = {
        numberParseOptions: {
          leadingZeros: true,
          hex: true,
          skipLike: /\+[0-9]{10}/,
        },
        trimValues: true,
        removeNSPrefix: true,
        processEntities: false,
        parseTagValue: true,
      };

      const parser = new XMLParser(options);
      return parser.parse(xmlData);

Output

image

expected data

Don't throw an error

Would you like to work on this issue?

github-actions[bot] commented 3 months ago

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

amitguptagwl commented 3 months ago

How big your file is? Can you post the content here? Can you try to set contents in a string and try? Probably there are some invalid characters in the XML.