Old 17-12-2007, 12:42   #1 (permalink)
Daniel Diggle
oh dear me™
 
Daniel Diggle's Avatar
 
Join Date: Sep 2006
Location: UK, London
Posts: 117
Send a message via MSN to Daniel Diggle
XML Data Structure

Hiya, this might be a bit much, but I'm looking for some advice on structuring info with xml for flash. I'm putting together a photography site with several pre-defined categories that have dynamic sub categories. These sub categories load in a selection of images with information, thumbs etc.

Sorry if it's a bit vague, I'm trying to get my head around using objects or arrays to present a fair amount of info.

Does it look like I'm heading in the right direction?



Category XML
Code:
<categories> <cat1> <item title="cat1item1" itemXml="/cat1/item1/photos.xml></item> <item title="cat1item2" itemXml="/cat1/item2/photos.xml></item> <item title="cat1item3" itemXml="/cat1/item3/photos.xml></item> </cat1> <cat2> <item title="cat2item1" itemXml="/cat2/item1/photos.xml></item> <item title="cat2item2" itemXml="/cat2/item2/photos.xml></item> </cat2> <cat3> <item title="cat3item1" itemXml="/cat3/item1/photos.xml></item> </cat3> </categories>

Photos XML
Code:
<photos> <item> <image>cat1/item1/img/img_1.jpg</image> <thumbnail>cat1/item1/tmb/tmb_1.jpg</thumbnail> <title>Title for Image 1</title> <info>Info text for Image 1, cat 1</info> </item> <item> <image>cat1/item1/img/img_2.jpg</image> <thumbnail>cat1/item1/tmb/tmb_2.jpg</thumbnail> <title>Title for Image 2</title> <info>Info text for Image 2, cat 1</info> </item> <item> <image>cat1/img/item1/img_3.jpg</image> <thumbnail>cat1/item1/tmb/tmb_3.jpg</thumbnail> <title>Title for Image 3</title> <info>Info text for Image 3, cat 1</info> </item> </photos>
__________________
Shazaam!
  Reply With Quote
Old 22-12-2007, 02:05   #2 (permalink)
.simplestick
By the power of greyskull
 
.simplestick's Avatar
 
Join Date: Sep 2006
Location: Canada
Posts: 39
Looks good to me.

When it comes down to stuff like this it's really just a matter of preference and what the application is intended for.

if it were me, I might simplify the photos.xml by using tag attributes similar to what you did with the categories.xml...

ex:

Code:
<photos> <item title="Title for Image 1"> <image thumb="cat1/item1/tmb/tmb_1.jpg">cat1/item1/img/img_1.jpg</image> <info>Info text for Image 1, cat 1</info> </item> </photos>

By adding a "thumb" attribute to the image tag, we effectively eliminate the need for a thumbnail tag. And by adding the "title" attribute to the item tag we eliminate yet another tag. Doing this makes the title more easily accessible (higher in the stack) should you need to access it before looping through sub items.

Again it's merely a matter of preference
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8