Reputation: 131730
I'm creating an RSS (and/or Atom) feed for my website. Now, I can immediately think of two ways to do this:
Are there particular reasons to choose one approach over the other? From initial impressions, I'm leaning toward option 1, mostly because it's easier to understand.
EDIT: so I got one good answer from Bill. But in this particular case all the values for the fields of the RSS feed are already formatted as well-formed, properly escaped XHTML... any other opinions?
Upvotes: 0
Views: 628
Reputation: 431
Template are often faster and easier but if you want to make sure you generate valid xml and rss/atom then you should use the xml library. If you write a test which validates your template generated xml then you should be fine.
Upvotes: 0
Reputation: 3672
Having done it both ways, I prefer #2. It'll do a better job escaping entities as needed, ensuring you produce well-formed XML, etc.
Upvotes: 3