xml
Is it possible to have an element in XSD Schema only in case of specific value for another element in schema?
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?
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.
Related Links
Oracle SQL issue with selecting invalid chars
xs:unique - Enforce Unique Attribute Values in Schema on abstract element
Tomcat deploying 2 aplications with 2 databases
Browse an xml tree and get a specific value
XSLT for-each loop and nodes with different pattern
Removing tags in lisp program
How do you specify a XmlAccessorType to be used for JAXB xjc-generated classes
magento, add cron with config.xml file
Validating XML Data with XSD
How i get the soap structure of my WCF?
Visual Studio 2012 XML intellisense broken due to auto-loading duplicate xsd files
Excel to XML - duplicating records on highest level
what how to get a node from an xml document using xslt
Multilevel XSD constraint
XML parsing using xpath for child node containing default namespace
Adding Dynamic Content to an XML Document