Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-15-2011, 02:09 AM   #1 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 36
DrJones is on a distinguished road
Smile Problem with SMXMLParser

Hi, im using a xmlparser called SMXMLDocument. SMXMLDocument

I use NSURLConnection and NSURL to fetch the XML down and that works fine. I can log it in the console.

Code:
- (void)connectionDidFinishLoading:(NSURLConnection *)conn 
{
    NSString *fetchedXML = [[[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease];
    NSLog(@"%@", fetchedXML);
    
    [xmlData release];
    xmlData = nil;
    
    [connection release];
    connection = nil;
    
    [self performSelector:@selector(parseXML)];
    
}

-(void)parseXML
{
    
    SMXMLDocument *document = [SMXMLDocument documentWithData:xmlData error:nil];
    
    SMXMLElement *content = [document.root childNamed:@"content"];
    

    for (SMXMLElement *name in [content childrenNamed:@"name"])
    {
        NSString *name = [name valueWithPath:@"name"];
        NSLog(@"name:%@", name);
    }
}
I use this code in -(void)parseXML to parse the xml but nothing gets logged. Can anyone help me figure out what i am doing wrong?

My XML looks like this

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<content>
<name>John Doe</name>
</content>
Thanks!
DrJones is offline   Reply With Quote
Old 12-15-2011, 12:38 PM   #2 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 36
DrJones is on a distinguished road
Default

Quote:
Originally Posted by DrJones View Post
Hi, im using a xmlparser called SMXMLDocument. SMXMLDocument

I use NSURLConnection and NSURL to fetch the XML down and that works fine. I can log it in the console.

Code:
- (void)connectionDidFinishLoading:(NSURLConnection *)conn 
{
    NSString *fetchedXML = [[[NSString alloc] initWithData:xmlData encoding:NSUTF8StringEncoding] autorelease];
    NSLog(@"%@", fetchedXML);
    
    [xmlData release];
    xmlData = nil;
    
    [connection release];
    connection = nil;
    
    [self performSelector:@selector(parseXML)];
    
}

-(void)parseXML
{
    
    SMXMLDocument *document = [SMXMLDocument documentWithData:xmlData error:nil];
    
    SMXMLElement *content = [document.root childNamed:@"content"];
    

    for (SMXMLElement *name in [content childrenNamed:@"name"])
    {
        NSString *name = [name valueWithPath:@"name"];
        NSLog(@"name:%@", name);
    }
}
I use this code in -(void)parseXML to parse the xml but nothing gets logged. Can anyone help me figure out what i am doing wrong?

My XML looks like this

Code:
<?xml version="1.0" encoding="UTF-8" ?>
<content>
<name>John Doe</name>
</content>
Thanks!
can anyone help please?
DrJones is offline   Reply With Quote
Reply

Bookmarks

Tags
ios sdk, smxmldocument, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 394
13 members and 381 guests
7twenty7, AppsBlogger, Creativ, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, Sami Gh, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0