Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Quick little XML question...
I am looking to automate some of the calendars on our website. I've decided that the best way to go about this would be to put the information into XML, and then use aApache Velocity to iterate through and write the content to the page.
I am kind of wondering, though, as to the formatting of some of it. What I want is to create containers for each month that hold sub-containers for each event. So, for example...
<event-title>Eight Week Session 2 Withdrawal Deadline</event-title>
The thing I'm wondering about, though, is that < month > tag. I know it will work if I do it that way (my foreach loop will grab the April value and put it in my "month" container in the HTML), but is there a better way of writing this?
Any insight would be greatly appreciated. :)
Um.."I am looking to automate some of the calendars on our website. I've decided that the best way to go about this" is really not really a "little" question because even if an expert in XML saw this question they know nothing about your site (you didn't even provide a link).
As to the example you provided it seems fine to me --in which way did you want it to be "better"?
Did you want more elaborate nesting for the events?
Did you want the events xml keep separately from the months xml and have a separate set of xml that connects them (which would generally be a bit more "granular" and allow the events to be developed/coded separately from any date-time elements)?
In order to recommend better ways of doing things we have to know what your ultimate goals are..
You could just be using this as a way to learn more about XML in general, I don't know.
Or maybe you want your website to have more functionality for a user standpoint.
In which case we would have to know what you want the users to be able to do.