0
 Below is the single item from XML :
<item>
<guid>http://www.businessinsider.com/european-markets-open-dec-24-2014-2014-12</guid>
                    <title>10 Things You Need Before European Markets Open</title>
                    <link>http://www.businessinsider.com/european-markets-open-dec-24-2014-2014-12</link>
                    <pubDate>Wed, 24 Dec 2014 02:52:00 -0500</pubDate>
<media:thumbnail url="http://static6.businessinsider.com/image/549a70f0dd0895a63a8b4567/10-things-you-need-before-european-markets-open.jpg" />
                                                                <media:credit>REUTERS/Dylan Martinez</media:credit>
                                    </item>

As you have noticed all the tags have end tags accept media:thumnnail and i have to parse the attribute url value from it.

Prateek Yadav
  • 932
  • 6
  • 8

1 Answers1

0

Regardless of having other content, if you need to get attributes from a tag, you do it in your override of the DefaultHandler startElement method, which will be called with a value in the Attributes parameter.

To get the value of a specific attribute name from this parameter, use the Attributes getValue method.

For an example of parsing attributes(though not actually using the getValue method), see my answer to this related question.

Community
  • 1
  • 1
Don Roby
  • 40,677
  • 6
  • 91
  • 113