Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

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.

$
0
0

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


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>