<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -317,20 +317,47 @@ void tagsouppullparser::remove_trailing_whitespace(std::string&amp; s) {
 }
 
 void tagsouppullparser::parse_tag(const std::string&amp; tagstr) {
-	std::vector&lt;std::string&gt; tokens = utils::tokenize(tagstr);
-	if (tokens.size() &gt; 0) {
-		text = tokens[0];
-		if (tokens.size() &gt; 1) {
-			std::vector&lt;std::string&gt;::iterator it = tokens.begin();
-			++it;
-			while (it != tokens.end()) {
-				add_attribute(*it);
-				++it;	
-			}
+	std::string::size_type last_pos = tagstr.find_first_not_of(&quot; \r\n\t&quot;, 0);
+	std::string::size_type pos = tagstr.find_first_of(&quot; \r\n\t&quot;, last_pos);
+	unsigned int count = 0;
+
+	LOG(LOG_DEBUG, &quot;parse_tag: parsing '%s', pos = %d, last_pos = %d&quot;, tagstr.c_str(), pos, last_pos);
+
+	while (last_pos != std::string::npos) {
+		if (count == 0) {
+			// first token: tag name
+			if (pos == std::string::npos)
+				pos = tagstr.length();
+			text = tagstr.substr(last_pos, pos - last_pos);
+			LOG(LOG_DEBUG, &quot;parse_tag: tag name = %s&quot;, text.c_str());
 		} else {
-			if (text.length() &gt; 0 &amp;&amp; text[text.length()-1] == '/')
-				text.erase(text.length()-1, 1);
+			pos = tagstr.find_first_of(&quot;= &quot;, last_pos);
+			std::string attr;
+			if (pos != std::string::npos) {
+				LOG(LOG_DEBUG, &quot;parse_tag: found = or space&quot;);
+				if (tagstr[pos] == '=') {
+					LOG(LOG_DEBUG, &quot;parse_tag: found =&quot;);
+					if (tagstr[pos+1] == '\'' || tagstr[pos+1] == '&quot;') {
+						pos = tagstr.find_first_of(&quot;'\&quot;&quot;, pos+2);
+						if (pos != std::string::npos)
+							pos++;
+						LOG(LOG_DEBUG, &quot;parse_tag: finding ending quote, pos = %d&quot;, pos);
+					} else {
+						pos = tagstr.find_first_of(&quot; \r\n\t&quot;, pos+1);
+						LOG(LOG_DEBUG, &quot;parse_tag: finding end of unquoted attribute&quot;);
+					}
+				}
+			}
+			if (pos == std::string::npos) {
+				LOG(LOG_DEBUG, &quot;parse_tag: found end of string, correcting end position&quot;);
+				pos = tagstr.length();
+			}
+			attr = tagstr.substr(last_pos, pos - last_pos);
+			LOG(LOG_DEBUG, &quot;parse_tag: extracted attribute is '%s', adding&quot;, attr.c_str());
+			add_attribute(attr);
 		}
+		last_pos = tagstr.find_first_not_of(&quot; \r\n\t&quot;, pos);
+		count++;
 	}
 }
 </diff>
      <filename>src/tagsouppullparser.cpp</filename>
    </modified>
    <modified>
      <diff>@@ -180,7 +180,7 @@ BOOST_AUTO_TEST_CASE(TestConfigParserContainerAndKeymap) {
 }
 
 BOOST_AUTO_TEST_CASE(TestTagSoupPullParser) {
-	std::istringstream is(&quot;&lt;test&gt;&lt;foo quux='asdf' bar=\&quot;qqq\&quot;&gt;text&lt;/foo&gt;more text&lt;more&gt;&amp;quot;&amp;#33;&amp;#x40;&lt;/more&gt;&lt;/test&gt;&quot;);
+	std::istringstream is(&quot;&lt;test&gt;&lt;foo quux='asdf' bar=\&quot;qqq\&quot;&gt;text&lt;/foo&gt;more text&lt;more&gt;&amp;quot;&amp;#33;&amp;#x40;&lt;/more&gt;&lt;xxx foo=bar baz=\&quot;qu ux\&quot; hi='ho ho ho'&gt;&lt;/xxx&gt;&lt;/test&gt;&quot;);
 	tagsouppullparser xpp;
 	tagsouppullparser::event e;
 	xpp.setInput(is);
@@ -214,6 +214,15 @@ BOOST_AUTO_TEST_CASE(TestTagSoupPullParser) {
 	BOOST_CHECK_EQUAL(e, tagsouppullparser::END_TAG);
 	BOOST_CHECK_EQUAL(xpp.getText(), &quot;more&quot;);
 	e = xpp.next();
+	BOOST_CHECK_EQUAL(e, tagsouppullparser::START_TAG);
+	BOOST_CHECK_EQUAL(xpp.getText(), &quot;xxx&quot;);
+	BOOST_CHECK_EQUAL(xpp.getAttributeValue(&quot;foo&quot;), &quot;bar&quot;);
+	BOOST_CHECK_EQUAL(xpp.getAttributeValue(&quot;baz&quot;), &quot;qu ux&quot;);
+	BOOST_CHECK_EQUAL(xpp.getAttributeValue(&quot;hi&quot;), &quot;ho ho ho&quot;);
+	e = xpp.next();
+	BOOST_CHECK_EQUAL(e, tagsouppullparser::END_TAG);
+	BOOST_CHECK_EQUAL(xpp.getText(), &quot;xxx&quot;);
+	e = xpp.next();
 	BOOST_CHECK_EQUAL(e, tagsouppullparser::END_TAG);
 	BOOST_CHECK_EQUAL(xpp.getText(), &quot;test&quot;);
 	e = xpp.next();</diff>
      <filename>test/test.cpp</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>66db6d0e73eac640a228bfbb36479c03fac92a26</id>
    </parent>
  </parents>
  <author>
    <name>Andreas Krennmair</name>
    <email>ak@synflood.at</email>
  </author>
  <url>http://github.com/akrennmair/newsbeuter/commit/db848d8ed593e772ac6c61f85322de9f8ead056d</url>
  <id>db848d8ed593e772ac6c61f85322de9f8ead056d</id>
  <committed-date>2009-10-22T14:54:55-07:00</committed-date>
  <authored-date>2009-10-22T14:54:55-07:00</authored-date>
  <message>tag soup pull parser: added support for spaces in attributes.</message>
  <tree>6e245994facb491e0ed9845841f583a407ac075b</tree>
  <committer>
    <name>Andreas Krennmair</name>
    <email>ak@synflood.at</email>
  </committer>
</commit>
