python / python/cpython

xml.dom.minidom: the DOM Level 3 Load and Save API is mostly unimplemented

未关闭
#156,668 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

stdlib topic-XML type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Every xml.dom.minidom document inherits DocumentLS, and most of it raises NotImplementedError:

>>> doc.load("x")
NotImplementedError: haven't written this yet
>>> doc.loadXML("<a/>")
NotImplementedError: haven't written this yet
>>> doc.abort()
NotImplementedError: haven't figured out what this means yet
>>> minidom.getDOMImplementation().createDOMWriter()
NotImplementedError: the writer interface hasn't been written yet!

Only saveXML(), createDOMBuilder() and createDOMInputSource() work. DocumentLS also defines _get_async() and _set_async(), where the setter should reject asynchronous loading, but they are never made a property, so async_ is a plain class attribute and doc.async_ = True silently succeeds.

The names come from a working draft. The final Recommendation defines LSParser, LSSerializer, LSInput, LSOutput, LSResourceResolver, LSParserFilter and DOMImplementationLS with createLSParser(), createLSSerializer(), createLSInput() and createLSOutput(), and defines no DocumentLS, DOMBuilder, DOMWriter, DOMEntityResolver or DOMInputSource at all.

Nothing of this is documented -- xml.dom.xmlbuilder has no documentation page, and DocumentLS, DOMImplementationLS, DOMBuilderFilter and Options are not in its __all__ -- and there is no successor in the WHATWG DOM Standard, where parsing and serialization are DOMParser and XMLSerializer in the HTML Standard.

So the question is whether to implement the missing parts, deprecate the whole feature, or leave it and document it as unimplemented. See also gh-152142 about DOMBuilderFilter.

Linked PRs
  • gh-156735

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先检查 xml.dom.minidom.DocumentLS 和 xml.dom.xmlbuilder,然后将它们的 API 与链接的 DOM Level 3 Load and Save Recommendation 进行比较。在决定受影响的接口应实现、弃用还是记录为未实现之前,先检查 gh-156735 和 gh-152142;完成的要求是确定一致的方向并进行相应的项目更改。

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

评估

技术栈
python
领域
backend-api-design
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

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