Question

I am trying to parse a xml given below with touchXml, i searched and found it is using name space so i need to use name space to parse that xml. but can any one please guide me exact name space for getting all the sub records of entry tag. i tried a lot of combination but i think i am not geting the point how to get the entry tag data.

<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0">
<id>tag:blogger.com,1999:blog-2497739505751584707</id>
<updated>2012-03-16T22:56:53.663-07:00</updated>
<title type="text">Recipes</title>
<subtitle type="html" />
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://acaiberryrecipes.blogspot.com/feeds/posts/default" />
<link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2497739505751584707/posts/default" />
<link rel="alternate" type="text/html" href="http://acaiberryrecipes.blogspot.com/" />
<link rel="hub" href="http://pubsubhubbub.appspot.com/" />
<link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2497739505751584707/posts/default?start-index=26&max-results=25" />
<author>
    <name>default.com</name>
    <uri>http://www.blogger.com/profile/05035355929944075160</uri>
    <email>noreply@blogger.com</email>
    <gd:image height="32" rel="http://schemas.google.com/g/2005#thumbnail" src="http://www.allauthentic.com/images/aalogo.gif" width="29" />
</author>
<generator version="7.00" uri="http://www.blogger.com">Blogger</generator>
<openSearch:totalResults>64</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<entry>
    <id>tag:blogger.com,1999:blog-2497739505751584707.post-5806304525333943936</id>
    <published>2010-01-05T12:09:00.001-08:00</published>
    <updated>2010-01-16T00:36:01.451-08:00</updated>
    <title type="text">Welcome To Amazon Thunder! Check out our free recipes (updated), shopping list, easy ordering, and more! Please give us 5 stars in the app store</title>
    <content type="html" />
    <link title="Post Comments" rel="replies" type="application/atom+xml" href="http://acaiberryrecipes.blogspot.com/feeds/5806304525333943936/comments/default" />
    <link title="0 Comments" rel="replies" type="text/html" href="http://acaiberryrecipes.blogspot.com/2010/01/welcome-to-amazon-thunder-on-your.html#comment-form" />
    <link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2497739505751584707/posts/default/5806304525333943936" />
    <link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2497739505751584707/posts/default/5806304525333943936" />
    <link title="Welcome To Amazon Thunder! Check out our free recipes (updated), shopping list, easy ordering, and more! Please give us 5 stars in the app store" rel="alternate" type="text/html" href="http://acaiberryrecipes.blogspot.com/2010/01/welcome-to-amazon-thunder-on-your.html" />
    <author>
        <name>ALLAuthentic.com</name>
        <uri>http://www.blogger.com/profile/05035355929944075160</uri>
        <email>noreply@blogger.com</email>
        <gd:image height="32" rel="http://schemas.google.com/g/2005#thumbnail" src="http://www.allauthentic.com/images/aalogo.gif" width="29" />
    </author>
    <thr:total>0</thr:total>
</entry>
Was it helpful?

Solution

Your default namespace (which is what entry appears to use) is http://www.w3.org/2005/Atom as specified by:

xmlns="http://www.w3.org/2005/Atom"

OTHER TIPS

NSDictionary *nameSpace=[NSDictionary dictionaryWithObjectsAndKeys: @"http://www.w3.org/2005/Atom",@"xmlns", @"http://www.georss.org/georss",@"georss", @"http://a9.com/-/spec/opensearchrss/1.0/",@"openSearch", @"http://schemas.google.com/blogger/2008",@"blogger", @"http://schemas.google.com/g/2005",@"gd", @"http://purl.org/syndication/thread/1.0",@"thr", nil]; resultNodes=[xmlDoc nodesForXPath:@"//xmlns:feed//xmlns:entry" namespaceMappings:nameSpace error:&error];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top