0

My XML Schema looks like -

<element name="PurchaseOrderInformation">
    <complexType>
        <sequence>
            <element ref="pidx:PurchaseOrderNumber"/>
            <element ref="pidx:PurchaseOrderIssuedDate" minOccurs="0"/>
            <element ref="pidx:PurchaseOrderTypeCode" minOccurs="0"/>
            <element ref="pidx:ReleaseNumber" minOccurs="0"/>
            <element ref="pidx:SalesOrderNumber" minOccurs="0"/>
            <element ref="pidx:RevisionNumber" minOccurs="0"/>
        </sequence>
    </complexType>
</element>
<element name="PurchaseOrderIssuedDate" type="date"/>
<element name="PurchaseOrderLineItemNumber" type="string"/>

Whenever customer name is "ABC" , i need to have PurchaseOrderLineItemNumber element under PurchaseOrderInformation complex type.

Is there any way to achieve this?

potame
  • 7,597
  • 4
  • 26
  • 33
user2885928
  • 323
  • 1
  • 6
  • 13

1 Answers1

1

XSD 1.0

Constraining the values of elements based upon other elements is not possible in XSD 1.0.

XSD 1.1

XSD 1.1 has assertions that allow constraints to vary per values per document. If XSD 1.1 isn't an option (as it is not for libxml, .NET, etc), then such checks have to be performed outside of XSD.

kjhughes
  • 106,133
  • 27
  • 181
  • 240