我有以下xsd schema
: -
<xsd:element name="content-transaction">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ClientID" type="xsd:string"/>
<xsd:element name="ContentTypeParent">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:minInclusive value="1"/>
<xsd:maxInclusive value="3"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Item" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Active">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:minInclusive value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:choice>
<xsd:element name="Images" type="ImagesType"></xsd:element>
<xsd:element name="Audio" type="AudioType">
<xsd:annotation>
<xsd:documentation>based on Content Type Parent, Audio = 2</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="Video" type="VideoType">
<xsd:annotation>
<xsd:documentation>based on Content Type Parent Video = 3</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ImagesType">
<xsd:sequence>
<xsd:element name="DPI" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxInclusive value="1000000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="AudioType">
<xsd:sequence>
<xsd:element name="UPC" minOccurs="0">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="VideoType">
<xsd:sequence>
<xsd:element name="SeasonNum" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:maxInclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
现在验证来自Image
,Audio
和Video
的任何选项。但是我希望它根据ContentTypeParent
进行验证,例如,如果1
2
然后Audio
和3
{x}只有SELECT
c.CourseStandard,
c.CourseID,
c.CourseRef,
c.CourseStandard,
c.CourseName,
c.CourseDuration,
c.NQFLevel,
c.CoursePrice,
csd.StartDate
FROM etcgroup.tblcourses c
INNER JOIN etcgroup.tblcoursestartdates csd ON csd.CourseID = tblcourses.CourseID
WHERE csd.StartDate >= Now()
AND c.CourseID NOT IN
(
SELECT CourseID
FROM tblbookings
WHERE StudentID = 12345
);
图像标记应该出现在xml文件中为'视频'。
我是xsd的新手,我已经尝试过,但找不到任何方法让它工作。