複数のXSDファイルに対してXMLファイル(またはその一部)を検証するための最良の方法は何ですか?
たとえば、構成ローダーのスキーマは次のとおりです。
<xsd:schema xmlns="http://www.kauriproject.org/schema/configuration"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.kauriproject.org/schema/configuration"
elementFormDefault="qualified">
<xsd:element name="configuration" type="configuration" />
<xsd:complexType name="configuration">
<xsd:choice maxOccurs="unbounded">
<xsd:element name="import" type="import" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="section" type="section" />
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="section">
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="type" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:complexType name="import" mixed="true">
<xsd:attribute name="resource" type="xsd:string" />
</xsd:complexType>
</xsd:schema>
Configurationクラスが存在するため、具体的なパーサークラスを定義するタグを追加できます<section>
(ASP.NETのカスタム構成セクションとよく似ています)。ただし、解析されているセクションを検証する方法がわかりません。
ファイルに書き戻さずに、XSDファイル/文字列を使用してコードのこのセクションだけを検証できる場合はどうでしょうか。