fast-xml-parser icon indicating copy to clipboard operation
fast-xml-parser copied to clipboard

Object doesn't support property or method 'trimStart'

Open asaadbaw opened this issue 9 months ago • 2 comments

  • [ x] Are you running the latest version?
  • [ x] Have you included sample input, output, error, and expected output?
  • [x ] Have you checked if you are using correct configuration?
  • [ x] Did you try online tool?

Description

I have a uwp reactnative app when I run as debug works fine but when I release the application it gives me this error: Object doesn't support property or method 'trimStart'

Input

xml checked online in many xml validation tools and its fine

Code

private parser_options = { ignoreAttributes: false, ignoreDeclaration: true, ignorePiTags: true, parseTagValue: false, trimValues: false, };

constructor(xml_str?: string) { try { const parser = new XMLParser(this.parser_options);

  if (xml_str) {
    this.xml_object = parser.parse(xml_str) ?? {
      '?xml': { '@_version': '1.0', '@_encoding': 'UTF-8' },
    };
  } else {
    this.xml_object = {
      '?xml': { '@_version': '1.0', '@_encoding': 'UTF-8' },
    };
  }
} catch (e) {
  console.log({
    type: 'exception',
    timestamp: new Date(),
    xml_str,
    error: e.message,
  });
}

}

Output

expected data

Would you like to work on this issue?

  • [ ] Yes
  • [x ] No

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

asaadbaw avatar May 04 '24 15:05 asaadbaw

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.

github-actions[bot] avatar May 04 '24 15:05 github-actions[bot]

Can you please share the sample XML that is causing issue? smaller is preferable.

amitguptagwl avatar May 06 '24 08:05 amitguptagwl

Closing the issue. Please reopen if problem exist with sample XML and library version.

amitguptagwl avatar May 18 '24 11:05 amitguptagwl