2

I have two different xml, I would like to know how I can validate each of them with a single schema (xsd). this schema must be valid for two types of xml.

e. g.:

file1.xml

<product>all</product>

file2.xml

<data>data all</data>

Thanks!.

4

1 回答 1

1

它可能很简单:

<?xml version="1.0" encoding="utf-8" ?>
<!-- XML Schema generated by QTAssistant/XSD Module (http://www.paschidev.com) -->
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="product" type="xsd:string"/>
    <xsd:element name="data" type="xsd:string"/>
</xsd:schema>

...或者像拥有三个文件一样复杂,一个(您想要的一个 XSD)包括 file1.xsd 和 file2.xsd。

于 2013-02-22T01:46:08.557 回答