You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Saxon转换过程中Schema验证异常问题求助

问题:Saxon验证S1000D Schema时xlink类型未知报错

我们正在开发一款从复合数据集中提取S1000D数据模块XML文件并验证的应用。使用Saxon时出现Schema无效报错,提示xlink命名空间下的XLINKATT、XLINKATT3等类型未知,报错集中在crew.xsd的对应行。查看Schema能找到所有被引用的类型,且Oxygen可正常验证。我们用catalog.xml指向本地S1000D V4.2 Schema文件夹(包含xlink.xsd),Oxygen中运行XSL无问题,但Java应用构建后出现该异常,已通过代码设置Saxon加载catalog,求解决思路。

报错信息

Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/crew.xsd
Loading schema document http://www.w3.org/1999/xlink
Finished loading schema document http://www.w3.org/1999/xlink
Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/rdf.xsd
Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/dc.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/dc.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/rdf.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/crew.xsd
Error on line 948 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 3578 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT3
Error on line 3703 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT1
Error on line 1222 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT4
Error on line 1139 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 1185 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 5507 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT0
Error on line 5552 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT2
Error on line 5651 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT0
Warning 
   Errors were found in the schema
Warning 
   Validation will continue without the schema at
  http://www.s1000d.org/S1000D_4-2/xml_schema_flat/crew.xsd

crew.xsd相关代码片段

<xs:complexType name="dmRefElemType">
    <xs:sequence>
        <xs:element ref="dmRefIdent"/>
        <xs:element minOccurs="0" ref="dmRefAddressItems"/>
        <xs:element minOccurs="0" ref="behavior"/>
    </xs:sequence>
    <xs:attribute ref="referredFragment"/>
    <xs:attribute ref="applicRefId"/>
    <xs:attribute ref="id"/>
    <xs:attributeGroup ref="changeAttGroup"/>
    <xs:attributeGroup ref="securityAttGroup"/>
    <xs:attributeGroup ref="authorityAttGroup"/>
    <xs:attributeGroup ref="xlink:XLINKATT"/>
</xs:complexType>

catalog.xml内容

<!DOCTYPE catalog
 PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
 "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog catalog.xsd"
          prefer="system">
  <rewriteSystem systemIdStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
  <rewriteURI uriStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
</catalog>

Java代码设置Saxon加载catalog

Processor xsl_proc = new Processor(config);
xsl_proc.setCatalogFiles("catalog.xml");

内容的提问来源于stack exchange,提问作者twfurst

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 13:55:07