Attribute Parser

  • + 4 comments

    I was shocked when I read that most of you are using regex for this (wouldn't mind so much if the question gave any hint as to what it was even testing us on). My first instinct was to read the data into a tree of some sort, after all, isn't that how HTML is done in a browser? You guys have not shown any code- are you just reading the input into some uber long string and regexing that?!

    In the end I have created a map of elements (just a struct), each containing a map of attrs and a map of inner elements, so it works like a linked list of sorts. Then I just have to traverse this. Made it sound quite simple, but it's been many hours of work (and revisions as the limited examples didn't help).

    Bearing in mind the other challenges have taken anything from a few mins to half an hour at most, I'd like to join in with the people complaining this question needs re-wording or re-grading.