代码之家  ›  专栏  ›  技术社区  ›  Christian Berg

如何使用ant根据模式验证XML文件?

  •  3
  • Christian Berg  · 技术社区  · 17 年前

    <schemavalidate noNamespaceFile="schemas/Model.xsd" file="Model.xml"/>
    

    这会产生以下错误:

    [...]
    BUILD FAILED
    build.xml:65: The following error occurred while executing this line:
    build.xml:59: Parser does not support Xerces or JAXP schema features
    

    我正在使用最新的ant发行版(1.7.1)。是否需要其他库才能使验证生效?

    1 回复  |  直到 17 年前
        1
  •  5
  •   Christian Berg    17 年前

    schemavalidate任务实际上正在工作,如问题所示。

    问题是xsd文件不存在。不幸的是,错误消息相当混乱。Ant仅在以详细模式启动时才会抱怨缺少的文件。