NaturalIntelligence / NaturalIntelligence/fast-xml-validator

Validation of multiple root elements

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Description

The parser accepts inputs that have multiple XML root nodes, without raising an error. This is despite enabling the validator option "-v".

An XML document is expected to have one root element.

Input
<abc/><abc/>

There are two elements at the root level, which I expected to raise an error. The input is saved in a file named example.xml.

Code
./src/cli/cli.js -v example.xml
Output
{ abc: [ '', '' ] }

My question is: Why the XML validator doesn't throw an error?
Please note that xmllint rejects the input example as invalid.

Contributor guide

No contributing guide indexed for this repository

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 ./src/cli/cli.js -v example.xml with the two-root-element input described in the issue. Trace how the validator option is handled by the CLI and parser, then verify that multiple root nodes are rejected as invalid while a single-root XML document remains accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.