バックグラウンド
スキーマを使用して XML ドキュメントを検証します。
問題
問題の最も単純な形式が 2 つのファイルに示されています。
XML ドキュメント
<?xml version="1.0"?>
<recipe
xmlns:r="http://www.namespace.org/recipe">
<r:description>
<r:title>sugar cookies</r:title>
</r:description>
</recipe>
XSD ドキュメント
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema
version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:r="http://www.namespace.org/recipe">
<xsd:complexType name="recipe">
<xsd:choice>
<xsd:element name="description" type="descriptionType"
minOccurs="1" maxOccurs="1" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="descriptionType">
<xsd:all>
<xsd:element name="title">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:minLength value="5" />
<xsd:maxLength value="55" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:schema>
エラー
xmllintからの完全なエラー メッセージ:
file.xml:4: 要素レシピ: スキーマの有効性エラー: 要素 'recipe': 検証ルートに使用できる一致するグローバル宣言がありません。
質問
特定のスキーマを使用して特定の XML ドキュメントを正常に検証できるようにするための正しい構文 (または欠落しているスキーマ属性) は何ですか?