Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to read & write DOCTYPE information #639

Open
5 of 6 tasks
emmercm opened this issue Feb 11, 2024 · 2 comments
Open
5 of 6 tasks

Ability to read & write DOCTYPE information #639

emmercm opened this issue Feb 11, 2024 · 2 comments

Comments

@emmercm
Copy link

emmercm commented Feb 11, 2024

  • 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.

Copy link

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
Copy link
Member

Honestly speaking, I have never thought about it. But it can be considered for future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants