根据评论进行编辑,不使用图像。没有认为这对某些用户来说是负面的。
我们正在开发一个应用程序,在其中创建一些从“复合”数据集中提取的 XML 文件(S1000D 数据模块)。从复合材料中提取文件后,我们将对其进行验证。我们遇到了一个问题,架构被报告为无效:
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中第948行区域的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>
当我查看架构时,我可以找到所有引用的“未知类型”项目。 Oxygen 没有任何问题,并使用它来验证文件。我们使用目录文件指向存储所有 S1000D V4.2 模式的本地“模式”文件夹(包括 xlink.xsd)。 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>
从 Oxygen 运行此 XSL 时,没有发生这些错误。直到构建 Java 应用程序来使用它们才出现。我们像这样向 Saxon 提供目录:
Processor xsl_proc = new Processor(config);
xsl_proc.setCatalogFiles("catalog.xml");
希望有人对如何解决这个问题有任何想法。
找到解决方案了。我认为这可能是一个疏忽,或者根本没有意识到这是必要的。我编辑了目录文件来处理“xlink”uri:
<!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/" />
<uri name="http://www.w3.org/1999/xlink" uri="schemas/S1000D_4-2/xml_schema_flat/xlink.xsd"/>
</catalog>
一切都经过并进行了验证。感谢所有花时间查看并提供反馈的人。