Skip to content

Ability to read & write DOCTYPE information #639

Open
@emmercm

Description

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions