Implement XML::LibXML::Element->appendTextNode

未关闭 适合新手
#2,153 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
70/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
java, perl
领域
compilers

调研方向

从 src/main/perl/lib/XML/LibXML.pm 开始,XML::LibXML::Element 接口就在那里定义;将其与那里已经实现的相邻 text/child 方法进行比较,以了解节点是如何表示的。仿照系统 XML::LibXML 的 appendTextNode 语义,然后添加一个有针对性的测试(包括 XML::LibXML::Ferry::create 路径),并在 Perl、JVM 和解释器后端下运行它。完成意味着探针的 can("appendTextNode") 为 true,并且来自 Ferry v0.8.5 的 t/ferry-write.t 会运行全部 22 个测试直至完成。

由索引模型根据 Issue 内容生成。

描述

area:cpan-port bug

Summary

XML::LibXML::Element in the bundled PerlOnJava compatibility implementation does not provide appendTextNode. Pure-Perl XML::LibXML::Ferry calls this method when creating an element with text, so XML-LibXML-Ferry v0.8.5 aborts in t/ferry-write.t on both PerlOnJava backends.

Reproduction

use XML::LibXML;
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $element = $doc->createElement('Root');
$element->appendTextNode('text');

Under the PerlOnJava bundled XML::LibXML, this dies with:

Can't locate object method "appendTextNode" via package "XML::LibXML::Element"

The minimal Ferry trigger is:

use XML::LibXML::Ferry;
my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');
my $root = $doc->createElement('Root');
$root->create('Child', 'text');

XML::LibXML::Ferry::create calls $el->appendTextNode($text) at its element-creation path. The bundled src/main/perl/lib/XML/LibXML.pm defines the XML::LibXML::Element interface but has no appendTextNode implementation. System XML::LibXML provides the method, as shown by the complete upstream suite passing under system Perl.

Evidence

  • Distribution: XML-LibXML-Ferry v0.8.5; CPAN run 20261119-133823-51077.
  • PerlOnJava CPAN run: t/ferry-write.t exited 255 after 2 of 15 planned tests; remaining tests did not run because appendTextNode was missing.
  • System Perl oracle: the full suite passed, 6 test programs and 22 tests, after installing XML::LibXML and its prerequisites in an isolated CPAN environment.
  • Focused API probe on PerlOnJava v5.44.1, source commit 94cc21a9c4e81e1c0fff4debf384efde2f758f93: can("appendTextNode") returned false on both the JVM and interpreter backends.
  • Runtime used for the probe: Temurin Java 24.0.2 on macOS arm64.
  • XML::LibXML reverse-dependency lookup: 492 unique released runtime dependants, 85 with releases in the last five years. This is ecosystem context for the prerequisite; the target Ferry distribution itself is pure Perl.

Expected behavior

The bundled XML::LibXML::Element should support appendTextNode with behavior compatible with system XML::LibXML, so Ferry can create elements containing text and its write tests can run to completion on both backends.

Acceptance criteria

  • Add the missing XML::LibXML::Element method in the shared bundled implementation, matching system XML::LibXML behavior.
  • Add focused project-owned coverage for appending text to an element, including the Ferry creation path.
  • Verify the focused tests under standard Perl, PerlOnJava JVM, and PerlOnJava interpreter backends.
  • Re-run XML-LibXML-Ferry v0.8.5 tests and confirm all 22 tests pass under PerlOnJava.
主要语言
Perl
星标
67
派生
8
平均合并
5 小时 12 分钟
30 天内合并 PR
131

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fglock/PerlOnJava 的其他 Issue

查看 fglock/PerlOnJava 的全部 Issue

相似的 Issue

更多 Perl Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。