• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

在gentoo针对.dtd验证metadata.xml?

用户头像
it1352
帮助1

问题说明

我正在尝试验证元数据. xml www.gentoo.org/dtd/metadata相对. dtd 和 xmllint /dev-libs/libxml2"rel =" nofollow noreferrer> = dev-libs/libxml2-2.9.3 ebuild.

I am trying to validate metadata.xml against www.gentoo.org/dtd/metadata.dtd with xmllint from =dev-libs/libxml2-2.9.3 ebuild.

我尝试了这些命令(来自此处):

I tried the commands (some from here):

$ xmllint --noout --valid  metadata.xml
error : Unknown IO error
metadata.xml:2: warning: failed to load external entity "http://www.gentoo.org/dtd/metadata.dtd"

xmllint metadata.xml --dtdvalid metadata.dtd相同 和xmllint --loaddtd http://www.gentoo.org/dtd/metadata.dtd

the same for xmllint metadata.xml --dtdvalid metadata.dtd and xmllint --loaddtd http://www.gentoo.org/dtd/metadata.dtd

$ xmllint --valid  metadata.xml --schema metadata.dtd
metadata.dtd:1: parser error : StartTag: invalid element name

我需要xmllint而不是 mono-xmltool (的https://stackoverflow.com/questions/1658325>),因为repoman -d命令中使用了xmllint. repoman用于travis-ci中的gentoo覆盖验证

I need xmllint and not mono-xmltool (from C#/CLI) because xmllint is used in repoman -d command. And repoman is used for gentoo overlay validation in travis-ci

如何使用xmllint正确验证xml?

How to validate xml with xmllint properly?

UPD: 网站返回"HTTP/1.1 301永久移动",这就是加载失败的原因

UPD: site returns "HTTP/1.1 301 Moved Permanently" and that is why load fails

strace的一部分:

part of strace:

recvfrom(3, "HTTP/1.1 301 Moved Permanently\r\n"..., 4096, 0, NULL, NULL) = 446
recvfrom(3, "", 4096, 0, NULL, NULL)    = 0
close(3)                                = 0
write(2, "error : ", 8error : )                 = 8
write(2, "Unknown IO error\n", 17Unknown IO error

libxml2可能不执行https

probably libxml2 doesn't do https

USE="icu ipv6 python readline -debug -examples -lzma -static-libs {-test}"

libxml2使用nanoHTTP, nanoHTTP可以与HTTPS一起使用

libxml2 uses nanoHTTP, nanoHTTP can work with HTTPS

正确答案

#1

您的假设是正确的,问题出在HTTPS上.要解决此问题并节省一些带宽和时间,repoman会针对本地文件进行验证,如果找不到该文件,则会将其预取.默认位置为REPO_ROOT/metadata/dtd/metadata.dtdDISTDIR/metadata.dtd.要获取repoman用于xmllint的确切参数,您必须查看其源代码-

或使用HTTP:

I/O error : Attempt to load network entity http://www.gentoo.org/dtd/metadata.dtd
metadata.xml:2: warning: failed to load external entity "http://www.gentoo.org/dtd/metadata.dtd"
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">

但仅作为警告,因此命令以0退出.

But only as a warning, so the command exits with 0.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcakkck
系列文章
更多 icon
同类精品
更多 icon
继续加载