//
//  AxisAppDelegate.m
//  Axis
//
//  Created by Olivier Savard on 10-02-19.
//  Copyright OSInfo Informatique 2010. All rights reserved.
//

#import "AxisAppDelegate.h"
#import "XMLParser.h"
#import "Nouvelle.h"

@implementation AxisAppDelegate

@synthesize window;
@synthesize rootController;
@synthesize	listeNouvelles;



- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	
	NSURL *url = [[NSURL alloc] initWithString:@"http://www.web-k.org/os/index.xml"];
	//NSURL *url = [[NSURL alloc] initWithString:@"http://www.web-k.org/os/indexXML.php"];
	//NSString *string = [[NSString alloc]initWithContentsOfURL:@"http://www.web-k.org/os/indexXML.php"];
	//while (string != @"ok") {
		//NSURL *url = [[NSURL alloc] initWithString:@"http://www.web-k.org/os/indexXML.php"];
	//}
	NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
	
	//Initialize the delegate.
	XMLParser *parser = [[XMLParser alloc] initXMLParser];
	
	//Set delegate
	[xmlParser setDelegate:parser];
	
	//Start parsing the XML file.
	BOOL success = [xmlParser parse];
	
	if(success)
		NSLog(@"No Errors");
	else
		NSLog(@"Error Error Error!!!");		

	[window addSubview:rootController.view];
    [window makeKeyAndVisible];
	[url release];
	[xmlParser release];
	[parser release];
}


- (void)dealloc {
	[listeNouvelles release];
	[rootController release];
    [window release];
    [super dealloc];
}


@end
