Return to main assignment page
Assignment Number 1
I have a tendency to error towards collecting data if it is available, so I would probably grab as much information as possible about each car for both someone wanting to sell a car or someone wanting to repair a car. However, I would not necessarily distribute all of it, or make it initially available.
Also, in my ignorance about cars, I must admit that I didn't understand all of the information provided in the examples, nor did I see all of the information I would want as either a mechanic or a buyer. So, I added at least some of that information into my code below.
For the seller, I would focus on some key elements, like model, manufacturer, year, price, and mileage. But I bet a lot of buyers are way more into cars than I am, and they would probably appreciate the ability to drill down through the information about the engine, brakes, and so forth even if it's not initially displayed. And certainly the seller would like to have that information readily available if any potential buyers start asking more detailed questions. For a car mechanic, I imagine both more information about the engine, brakes, etc. as well as a maintenance history would be useful.
I initially put attributes on each element for the mechanic and for the seller, but then I decided that if I was going to proceed with this project I would use two stylesheets (XSLT) to create the two different views.
I have repeating element names such as <maintenance> and <type>. My programming experience tells me to never use the same variable or object name or else I will end up with namespace collisions. In this case each of these elements should have different names, such as <brake_maintenance> or <wheel_type>. However, I'm getting the impression that each of these elements is located by where it is within the nested structure (similar to how a table element can have the same name as another table element in the same database).
My final thought of the moment is on the lack of attributes below. I put several in at different points, and then I removed most of them. I think as an exercise I focused more on the nested aspects of the data and I am probably under-utilizing the possibilities of attributes.
<vehicle> <model></model> <manufacturer></manufacturer> <year></year> <engine> <model></model> <horsepower></horsepower> <differential></differential> <suspension></suspension> <coolant></coolant> <maintenance date=""></maintenance> </engine> <price> <sale></sale> <lease></lease> </price> <color></color> <miles></miles> <mileage> <street></street> <highway></street> </mileage> <brakes> <!-- Type examples include standard, hand, front, rear, etc. --> <type> <maintenance date=""></maintenance> </type> </brakes> <wheels> <type> <number></number> <maintenance date=""></maintenance> </type> </wheels> <graphic></graphic> <!-- The notes tag may become more specific with additional data --> <notes></notes> <contact> <name></name> <location></location> <email></email> <telephone></telephone> <website></website> </contact> </vehicle>