I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approaches:
<item> <id></id> <images> <image width='' height='' href='' alt='' sequence='1' /> <image width='' height='' href='' alt='' sequence='2' /> <image width='' height='' href='' alt='' sequence='3' /> <image width='' height='' href='' alt='' sequence='4' /> </images> </item>
Obviously there will be more nodes than this, but I’m not showing them all. I figured my primary image would always be the first in the sequence. The problem I’m having is that each of these images will have a thumbnail, medium and large images, so I’m thinking this needs to be broken down further.
Since XML elements have a natural order (that is, the order in which they appear in the XML file), it’s probably redundant to include the
sequenceattribute. You can still talk about the order of the elements and there is still a ‘first’ one for the primary product image.So perhaps: