none
How to define XSD for an XML that has a node, which will satisfy following 2 conditions. 1) Either empty 2) If it contains a value, it has to be of a definite length.

    Question

  • I've a requirement to validate a XML. Nodes in XML are of two types: Mandatory and Optional.

    Optional nodes are those who satisfy the below conditions.

    1) Either empty

    2) If it contains a value, it has to be of a definite length.

    Examples:

    Let us say ProductCode is the node (If not empty, value's length has to be 4. Type can be either string or int)

    <ProductCode /> - Valid

    <ProductCode>1233</ProductCode>  - Valid

    <ProductCode>12334</ProductCode>  - Invalid

    Friday, January 17, 2014 5:31 AM