//
// main.m
// homewoek
//
// Created by hehe on 15/9/9.
// Copyright (c) 2015年 wang.hehe. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "GDataXMLNode.h"
#import "my.h"
#define path @"http://mps.manzuo.com/mps/cate?sid=%28null%29&id=0&cc=beijing&pt=all&ffst=1&mnt=10&st=-1&hs=1"
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSURL *url = [[NSURL alloc] initWithString:path];
NSString *string = [NSString stringWithContentsOfURL:url encoding:4 error:nil];
GDataXMLDocument *doc = [[GDataXMLDocument alloc]initWithXMLString:string options:0 error:nil];
GDataXMLElement *rootResponse = [doc rootElement];
NSArray *arrResponseChild = [rootResponse children];
for(GDataXMLElement *Response in arrResponseChild)
{
if([[Response name] isEqualToString:@"list"])
{
NSArray *arrayList = [Response children];
for(GDataXMLElement *list in arrayList)
{
NSArray *arrPromotion = [list children];
for(GDataXMLElement *promotion in arrPromotion)
{
NSLog(@"%@=%@",[promotion name],[promotion stringValue]);
}
NSLog(@"...................................................");
}
}
else
{
NSLog(@"%@=%@",[Response name],[Response stringValue]);
}
}
}
return 0;
}