【发布时间】:2011-11-12 06:38:15
【问题描述】:
我在 Eclipse 中创建了一个新项目,只是为了验证一个 xml,这要归功于相应的 xsd。我写了 xsds 和 xml 文件。
主要的XSD是这样的:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.myurl.com/schemas"
targetNamespace="http://www.myurl.com/schemas"
version="1.0">
<xs:include schemaLocation="other_xsd.xsd"/>
[...]
other_xsd.xsd 在同一个目录下,就像:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.myurl.com/schemas"
targetNamespace="http://www.myurl.com/schemas">
主要包含主xsd中使用的complexTypes
xml 示例文件也在同一目录中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<myTag xmlns="http://www.myurl.com/schemas" myAttributes="2011-09-07">
所有这三个文件都已加载到我的 Eclipse 项目的同一目录中。然而我一直有这个警告:
未检测到文档的语法约束(DTD 或 XML 模式)。 example.xml XMLValidation/Test line 1 XML Problem
我的 xml 或 xsd 中缺少什么以便我可以验证我的 xml 文件?
【问题讨论】:
标签: xml eclipse xsd xsd-validation