且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将名称“X”解析为(n)“类型定义”组件

更新时间:2023-11-06 19:42:58

你是有权怀疑你必须在运行时Java代码中为你的XML目录做好准备。

You're right to suspect that you have to make accomodations for your XML catalog in your runtime Java code too.

参见将XML目录与内部使用JAXP的Java库一起使用,详细了解如何使用 CatalogResolver (或 org.apache.xml.resolver.tools.CatalogResolver

See Using an XML Catalog with a Java library that uses JAXP internally for details on how to use a CatalogResolver (or org.apache.xml.resolver.tools.CatalogResolver).

另请注意,通过将其放置在URI可访问的位置 1 并添加 @schemaLocation attri butes到你的 xs:imports 。许多XML Catalog实现的诊断消息不太适合追踪问题。

Note also that it can be useful to establish that all else is in order with your XSDs by placing them in URI-accessible locations1 and adding @schemaLocation attributes to your xs:imports. Many XML Catalog implementation's diagnostic messages are less than ideal for tracking down problems.

1 请参阅如何正确引用本地XML Schema文件?