Skip to content

Ability to read & write DOCTYPE information #639

Open

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.

Activity

  1. github-actions commented on Feb 11, 2024

    @github-actions

    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.

  2. amitguptagwl commented on Feb 12, 2024

    @amitguptagwl
    Member

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

  3. amitguptagwl commented on Apr 10, 2026

    @amitguptagwl
    Member

    This is probably a good case for @nodable/flexible-xml-parser

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

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