parsed xml file: skip creation if blank?
Posted
by GoodGets
on Stack Overflow
See other posts from Stack Overflow
or by GoodGets
Published on 2010-05-19T00:25:07Z
Indexed on
2010/05/19
0:30 UTC
Read the original article
Hit count: 574
This could be a HappyMapper specific question, but I don't think so.
In my app, users can upload their blog subscriptions (via an OPML file), which I parse and add to their profile. The only problem is during the parsing, or more specifically the creation of each subscription, I can't figure out how to skip over entries that are just "labels".
Since OPML files allow you to label your blogs, or organize them into folders, this is my problem. The actual blog subscriptions and their labels both have "outline" tags.
<outline text="Rails" >
<outline title="Katz Got Your Tongue?" text="Katz Got Your Tongue?" htmlUrl="http://yehudakatz.com" type="rss" xmlUrl="http://feeds.feedburner.com/KatzGotYourTongue" />
After parsing, I create each feed via a method call inside of the HappyMapper module
def create_feed
Feed.new( :feed_htmlUrl => self.htmlUrl, :feed_title => self.title, ...
But how do I prevent it from creating new "feeds" for those outline tags that are just tags? (i.e. those that don't have an htmlUrl?)
© Stack Overflow or respective owner