XML structure

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
I building a page for a client that will read in content from an XML file. One section of the page has several informational "modules" each with a title and content, which will be stored in the XML file. The client will be able to add/remove as many modules as he wants (within reason). The order of the modules is important to the client, but the information doesn't have any inherent index like a timestamp.

It's not a huge deal, but I'm wondering what you guys would think is the most intuitive or elegant way for storing this kind of data. I'm currently using method #3, but I'm wondering what could be considered the more "proper" way in regards to semantics, structure, separation of style/content, etc.

Method 1 has an "index" element which indicates its order.

Method 2 has the index as part of the element name.

Method 3 just relies on the order of appearance in the markup to provide the order these modules.
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
I think method 1 makes the most sense, but reordering the modules by hand is really tedious.
 

oog

Golden Member
Feb 14, 2002
1,721
0
0
give the modules unique ids and have a different section which lists the ordering.
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
Method 3 is much more intuitive, and prevents anyone from accidentally assigning the same index to two different products.
 

jjones

Lifer
Oct 9, 2001
15,424
2
0
Why not use method 3 but give the module element a unique ID attribute in case it's ever needed.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
Originally posted by: notfred
Method 3 is much more intuitive, and prevents anyone from accidentally assigning the same index to two different products.
That can easily be fixed by enforcing unique ids (via dtd or whatever). Sure they can still mess up, but they can also forget to close a tag or something...

Method 1 is the most proper.
 

KEV1N

Platinum Member
Jan 15, 2000
2,932
1
0
You can use method 3 with a "priority" element (or give each module a "priority" attribute) to control the display order. I think unique IDs is unnecessary if the client is going to be editing the XML file by hand.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |