NaturalIntelligence / NaturalIntelligence/fast-xml-parser

ignoreDeclaration does not ignore lower case doctype declaration

Open Beginner friendly
#870 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.1k
Forks
395
Avg merge
1d 20h
Merged PRs (30d)
1

Description

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?
  • Have you checked the docs for helpful APIs and examples?
Description

ignoreDeclaration does not ignore lower case doctype declaration.

Input
Code
const html = `<!doctype html><html></html>`;

const parser = new XMLParser({
  ignoreDeclaration: true,
});
let jObj = parser.parse(html);

console.log(jObj);
Output
{ '!doctype': { html: '' } }
expected data
{ html: '' }

Would you like to work on this issue?

  • Yes
  • No

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided JavaScript snippet with the XMLParser and ignoreDeclaration option, then inspect the parser's handling of doctype declarations. Confirm that lowercase <!doctype html> is treated consistently with the ignored declaration form. Done means the parsed result matches the expected { html: '' } output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.