Skip to content

Implement XML::LibXML::Dtd->parse_string for HTML-DTD compatibility #1348

Description

@fglock

Summary

The HTML-DTD 0.04 test suite fails under PerlOnJava because the bundled
XML::LibXML compatibility layer does not provide
XML::LibXML::Dtd->parse_string.

This is a PerlOnJava API-compatibility gap, not an HTML-DTD implementation
failure.

CPAN evidence

  • Distribution: HTML-DTD 0.04
  • CPAN run: 20260910-101908-8428
  • Failing test: t/validate.t
  • System Perl: the complete suite passed after installing HTML-DTD into an
    isolated prefix; the validation test was skipped because the system lacked
    XML::LibXML. An isolated XML::LibXML installation attempt was blocked by a
    missing Alien::Libxml2 prerequisite and unavailable CPAN network access.
  • PerlOnJava: five test programs pass; t/validate.t aborts when it calls the
    missing method.

Failure

PerlOnJava reports:

Can't locate object method "parse_string" via package "XML::LibXML::Dtd"

The minimal reproducer is:

use XML::LibXML;

my $dtd = XML::LibXML::Dtd->parse_string('<!ELEMENT root EMPTY>');

This fails under jperl with exit status 255. The same API is used by
HTML-DTD's t/validate.t after obtaining the XHTML DTD text.

Root cause

The bundled Perl implementation declares XML::LibXML::Dtd as a subclass of
XML::LibXML::Node, and the Java implementation wraps document-type nodes,
but no parse_string method is implemented or registered for the Dtd
package.

Expected behavior

XML::LibXML::Dtd->parse_string should parse a DTD string and return a usable
XML::LibXML::Dtd object with behavior compatible with upstream XML::LibXML.

Acceptance criteria

  • Add a focused project-owned regression test for
    XML::LibXML::Dtd->parse_string.
  • Confirm the expected behavior with system Perl using a usable XML::LibXML
    installation.
  • Implement and register the Dtd parsing API in the PerlOnJava XML::LibXML
    compatibility layer.
  • Run the focused regression on both JVM and interpreter backends.
  • Verify that HTML-DTD 0.04 t/validate.t passes under PerlOnJava.
  • Keep existing XML::LibXML compatibility tests green.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions