NaturalIntelligence / NaturalIntelligence/fast-xml-parser
Ability to read & write DOCTYPE information
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?
Description
Apologies if I missed this in the documentation, but I couldn't find it anywhere, even when stepping through the code.
I would like to read and write DOCTYPEs, including their public ID and system ID. xml2js has the ability to at least write them with the syntax:
xml2js.Builder({
doctype: {
pubID: '-//Logiqx//DTD ROM Management Datafile//EN',
sysID: 'http://www.logiqx.com/Dats/datafile.dtd',
});
Input
Here's some example XML from No-Intro:
<?xml version="1.0"?>
<!DOCTYPE datafile PUBLIC "-//Logiqx//DTD ROM Management Datafile//EN" "http://www.logiqx.com/Dats/datafile.dtd">
<datafile>
<header>
<name>Nintendo - Game Boy (Parent-Clone)</name>
<description>Nintendo - Game Boy (Parent-Clone)</description>
<version>20230729-000034</version>
<date>20230729-000034</date>
<author>aci68, akubi, Arctic Circle System, Aringon, baldjared, Bent, BigFred, BitLooter, buckwheat, C. V. Reynolds, chillerecke, darthcloud, DeadSkullzJr, Densetsu, DeriLoko3, ElBarto, foxe, fuzzball, Gefflon, Hiccup, hking0036, InternalLoss, Jack, jimmsu, Just001Kim, kazumi213, leekindo, Lesserkuma, Madeline, NESBrew12, NGEfreak, nnssxx, norkmetnoil577, NovaAurora, omonim2007, Powerpuff, PPLToast, Psychofox11, rarenight, relax, RetroUprising, rpg2813, sCZther, SonGoku, Tauwasser, togemet2, UnlockerPT, xNo, xprism, xuom2</author>
<url>https://www.no-intro.org</url>
</header>
<game name="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)">
<description>[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)</description>
<release name="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)" region="EUR"/>
<release name="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)" region="JPN"/>
<release name="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)" region="USA"/>
<rom name="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1).gb" size="256" crc="59c8598e" md5="32fbbd84168d3482956eb3c5051637f5" sha1="4ed31ec6b0b175bb109c0eb5fd3d193da823339f" status="verified"/>
</game>
<game name="[BIOS] Nintendo Game Boy Boot ROM (Japan) (En)" cloneof="[BIOS] Nintendo Game Boy Boot ROM (World) (Rev 1)">
<description>[BIOS] Nintendo Game Boy Boot ROM (Japan) (En)</description>
<rom name="[BIOS] Nintendo Game Boy Boot ROM (Japan) (En).gb" size="256" crc="c2f5cc97" md5="a8f84a0ac44da5d3f0ee19f9cea80a8c" sha1="8bd501e31921e9601788316dbd3ce9833a97bcbc" status="verified"/>
</game>
</datafile>
Code
new XMLParser({
attributeNamePrefix: '',
}).parse(xmlContents);
Output
See the above
expected data
See the above
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the XMLParser usage shown in the issue and inspect the parser and builder entry points for how declarations are handled. Add tests using the supplied DOCTYPE example, covering public and system IDs on reading and writing; done means both values are preserved and emitted in valid DOCTYPE syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100