2 ms·
Well, actually, an even better example is: <employees> <employee id="1"> <name>John</name> <city>London</city> </employee>
by commandlinefan 7y ago
Well, actually, an even better example is:
<employees>
<employee id="1">
<name>John</name>
<city>London</city>
</employee>
<employee id="1">
<name>Jack</name>
<city>Boston</city>
</employee>
I know what you’re trying to do there - you’re trying to “future-proof” your schema by allowing introduction of arbitrary new elements. Which means that there’s no standard way to guard against somebody omitting a required field (like “name”) or adding a new field like “creditCardNumber” - other than to document your acceptable key values in a non-standard format and add defensive code that a validating parser would have given you. You’re better off taking as much advantage of the format as you can.