在 macOS 上构建 PostgreSQL 文档时出错

问题描述 投票:0回答:1

我在 macOS 上尝试构建 PostgreSQL 文档时遇到了一个持续存在的问题。错误消息表明 XML 实体、外部实体存在问题。我已遵循 PostgreSQL 文档中概述的标准步骤,但遇到以下错误:

 ✘ spartacus@  ~/postgres/doc/src   master ±  make html
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C sgml html
/usr/bin/xmllint --nonet --path . --path . --output postgres-full.xml --noent --valid postgres.sgml
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
postgres.sgml:21: warning: failed to load external entity "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
]>
  ^
postgres.sgml:23: element book: validity error : No declaration for attribute id of element book
<book id="postgres">
                   ^
postgres.sgml:24: element title: validity error : No declaration for element title
 <title>PostgreSQL &version; Documentation</title>
                                                  ^
postgres.sgml:27: element corpauthor: validity error : No declaration for element corpauthor
  <corpauthor>The PostgreSQL Global Development Group</corpauthor>
                                                                  ^
postgres.sgml:28: element productname: validity error : No declaration for element productname
  <productname>PostgreSQL</productname>
                                       ^
postgres.sgml:29: element productnumber: validity error : No declaration for element productnumber
  <productnumber>&version;</productnumber>
                                          ^
postgres.sgml:30: element date: validity error : No declaration for element date
  &legal;
         ^
legal.sgml:6: parser error : Entity 'ndash' not defined
 <year>1996&ndash;2023</year>
                  ^
legal.sgml:14: parser error : Entity 'copy' not defined
  <productname>PostgreSQL</productname> is Copyright &copy; 1996&ndash;2023
                                                           ^
legal.sgml:14: parser error : Entity 'ndash' not defined
  <productname>PostgreSQL</productname> is Copyright &copy; 1996&ndash;2023
                                                                       ^
legal.sgml:19: parser error : Entity 'copy' not defined
  <productname>Postgres95</productname> is Copyright &copy; 1994&ndash;5
                                                           ^
legal.sgml:19: parser error : Entity 'ndash' not defined
  <productname>Postgres95</productname> is Copyright &copy; 1994&ndash;5
                                                                       ^
legal.sgml:49: parser error : chunk is not well balanced

^
postgres.sgml:30: parser error : Entity 'legal' failed to parse
  &legal;
         ^
make[1]: *** [postgres-full.xml] Error 1
make: *** [html] Error 2

附加信息:

  • 系统配置无需 ICU 支持。
  • 配置过程中未找到ICU库。
  • 在没有 ICU 的情况下执行命令:
    ./configure --without-icu

尝试的解决方案: 我根据在线研究和 PostgreSQL 文档尝试了以下解决方案:

  • 检查互联网连接,确保系统可以访问外部资源。
  • 确认
    xmllint
    已安装并在系统路径中可用。
  • 验证本地是否存在所需的 XML 实体。
  • 检查是否有任何可能干扰外部实体加载的代理配置。
  • 我还尝试在 postgres.sgml 文件中使用本地 *DOCTYPE 声明:
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "file:///Users/spartacus/postgres/doc/src/docbookx.dtd" [

尽管做出了这些努力,问题仍然存在。

postgresql xml-documentation
1个回答
0
投票

我按照以下步骤消除了错误,请从这个Github问题中获得帮助

  1. 卸载现有软件包:

    brew uninstall docbook docbook-xsl xmlto
    

    如果存在依赖问题,可以强制删除:

    brew uninstall --ignore-dependencies docbook docbook-xsl
    
  2. 安装所需的软件包:

    brew install docbook docbook-xsl xmlto
    
  3. 设置 XML_CATALOG_FILES: 将以下内容添加到您的

    ~/.bashrc
    ~/.zshrc

    export XML_CATALOG_FILES="/opt/homebrew/etc/xml/catalog"
    
  4. 重建 PostgreSQL 文档: 导航到 PostgreSQL 文档目录并运行:

    make html
    
  5. 打开 HTML 文档:

    open path/to/postgres/doc/src/sgml/html/index.html
    

该问题与无法从指定 URL 加载 DocBook XML DTD 有关。通过卸载并重新安装所需的包(docbook、docbook-xsl、xmlto),我确保正确设置了必要的 XML 实体和依赖项。

配置 XML_CATALOG_FILES 环境变量指向正确的 XML 目录文件,为 DocBook 实体提供必要的引用。这反过来又解决了加载问题,允许 PostgreSQL 文档构建顺利进行,这是我对此解决方案工作的看法

欢迎对此有任何其他见解。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.