Modified to ensure the id of <segment> is only ever a non negative integer. Required defining a BaseWithoutId element.

Requested by Subhasis Ray, who pointed out the types of the seg ids should be the same in <segment id=X> and
<parent segment=X>