|
From: | Richard Frith-Macdonald |
Subject: | Re: a question relate to gsxml |
Date: | Thu, 15 Aug 2002 16:53:49 +0100 |
On Friday, August 16, 2002, at 01:02 PM, such wrote:
hello, I have problem using it. I am using cvs version and I tried GSXMLParser *p; GSXMLDocument *d; MySAX *h; // MySAX : GSSAXHandler h = [MySAX new];p = [GSXMLParser parserWithSAXHandler:h withData: [@"<?xml version=\"1.0\"?><test></test>" dataUsingEncoding: NSUTF8StringEncoding]];if ([p parse]) { d = [p document]; NSLog(@"parse %@",[d version]); [d writeToFile:@"test.xml" atomically:YES]; } else { NSLog(@"error"); } but it only show GSXMLDocument - no data for initialization parse (nil) what I did wrong? thanks.
You supplied a GSSAXHandler object.If a GSSAXHandler object is supplied, it is assumed to handle the elements found in the document on the fly, and no GSXMLDocument is created. If you want to create a GSXMLDocument and then examine its contents, you should use [GSXMLParser parserWithData:] to create the parser.
[Prev in Thread] | Current Thread | [Next in Thread] |