On Jan 12, 2007, at 6:47 AM, Rakesh Midha wrote:

Hello

I was just wondering if there is any specific reason for using "sequence" elements in all our XSD schema's instead of "choice" elements.

In most of the mapped J2EE schema's choice is used. Because we are using sequence the order of elements is fixed, and if child elements are not in order we get invalid element exception all the time.

I could be wrong, but I thought I was usually copying the j2ee schemas usage. My impression was that only the web schema used choice. I didn't do a careful analysis :-)

If choice is used instead of sequence, we can definatly avoid those exceptions.

I liked sequence because you can tell if a particular kind of element is present by looking in only one place rather than having to look through the entire container element.

Anyone got an idea, why it is so? I hope I am not missing something important here.

I think it was mostly my preference plus a vague attempt to imitate the spec schemas. It's definitely not written in stone :-) Maybe we should see what other people like.

thanks
david jencks


Thanks
Rakesh

Reply via email to