1
  • Input for create Person (If PersonID don't exist then it is the input for creating new person, so input should contain other other four.)

    <Input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Person> <FirstName>First Name</FirstName> <LastName>Last Name</LastName> <Phone>1234567890</Phone> <Email>username@domain.com</Email> </Person> </Input>

  • Input for update Person (If it has PersonID, then that will be the input for an update and input should contain at least one from other four along with PersonID.)

    <Input xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Person> <PersonID>123456</PersonID> <FirstName>First Name</FirstName> <LastName>Last Name</LastName> <Phone>1234567890</Phone> <Email>username@domain.com</Email> </Person> </Input>

How to write single XSD to validate the input based on the PersonID?

Thanks.

  • You can't express your constraint in XSD 1.0, but see the duplicate link for how you could use `xs:assert` to express it in XSD 1.1. – kjhughes Sep 18 '18 at 21:50

0 Answers0