XSD选择标记(必填字段)

时间:2017-06-04 03:01:01

标签: xml xsd

从下面的选择元素中,R01和R99只应出现一次和必填字段。我厌倦了所有的可能性,但没有用..

请帮我制作以下01和99记录是强制性的,并且只能在文件中出现一次

    <?xml version="1.0" encoding="UTF-8" ?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            xmlns:tns="http://TargetNamespace.com/fileService"
            targetNamespace="http://TargetNamespace.com/fileService"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"

            nxsd:version="NXSD"
            nxsd:stream="chars"
            nxsd:encoding="US-ASCII"
>


  <xsd:element name="Root-Element">
    <xsd:complexType>
      <xsd:choice minOccurs="1" maxOccurs="unbounded" nxsd:choiceCondition="terminated" nxsd:terminatedBy="|">
        <xsd:element name="R01" type="tns:R01" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="01"  />
        <xsd:element name="R22" type="tns:R22" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="22"  />
        <xsd:element name="R45" type="tns:R45" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="45"  />
        <xsd:element name="R99" type="tns:R99" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:conditionValue="99"  />
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>
<xsd:complexType name="R01">
 <xsd:sequence>
  <xsd:element name="name1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="|"/>
   <xsd:element name="name2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
   </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="R22">
 <xsd:sequence>
  <xsd:element name="name1"  type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="|"/>
   <xsd:element name="name2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
 </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="R45">
 <xsd:sequence>
  <xsd:element name="name1"  type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="|"/>
   <xsd:element name="name2" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="|"/>
   <xsd:element name="name3" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
 </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="R99" >
 <xsd:sequence >
<xsd:element name="name1" type="xsd:string"  nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
   </xsd:sequence>
</xsd:complexType>
</xsd:schema>

0 个答案:

没有答案