代码之家  ›  专栏  ›  技术社区  ›  Ishaan Adarsh

在macOS上构建PostgreSQL文档时出错

  •  0
  • Ishaan Adarsh  · 技术社区  · 10 月前

    我在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文档的解决方案:

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

    尽管作出了这些努力,但问题依然存在。

    0 回复  |  直到 10 月前
        1
  •  0
  •   Ishaan Adarsh    10 月前

    我遵循了以下步骤来消除错误,这有助于 Github issue :

    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文档构建能够顺利进行,这是我对该解决方案工作的看法

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