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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![William J. Terrell](https://secure.gravatar.com/avatar/5dc86176dfc12c9d2bcdb7aac10a0a6b?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
William J. Terrell
17,403 PointsQuick 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...
<academic-calendar>
<month>April
<cal-list-item>
<date>Apr. 15</date>
<day-of-week>Friday</day-of-week>
<event>
<event-title>Eight Week Session 2 Withdrawal Deadline</event-title>
<event-info>4:30 p.m.</event-info>
<event-symbol></event-symbol>
</event>
</cal-list-item>
</month>
</academic-calendar>
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. :)
Thanks!
1 Answer
![james white](https://secure.gravatar.com/avatar/efa478ff972258f599ff107b3944765c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
james white
78,399 PointsUm.."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.