対応する xsd のおかげで xml を検証するためだけに、Eclipse で新しいプロジェクトを作成しました。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">
ほとんどの場合complexType
、メインの xsd で使用される sが含まれています
xml サンプル ファイルも同じディレクトリにあり、次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<myTag xmlns="http://www.myurl.com/schemas" myAttributes="2011-09-07">
これら 3 つのファイルはすべて、Eclipse プロジェクトの同じディレクトリ内にロードされています。それでも、私はこの警告を出し続けます:
ドキュメントの文法制約 (DTD または XML スキーマ) は検出されませんでした。example.xml XMLValidation/テスト行 1 XML の問題
xml ファイルを検証できるように、xml または xsd に欠けているものは何ですか?