Re: NSXMLParser and NSDocument

2009-04-30 Thread Jeffrey Oleander

 On Tue, 2009/04/28, Graham Cox graham@bigpond.com wrote:
 On 2009/04/29, at 08:34, Jeffrey Oleander wrote:
 I've been having 2 intermittent compilation errors
 on 10.3.9 in
 - (BOOL)loadDataRepresentation:(NSData*)data
 ofType:(NSString*)fileType
 {
     BOOL success;
     NSString * lowercaseFileType =
 [fileType lowercaseString];
     NSLog(@fileType=%S,
 lowercaseFileType);
 
 %S specifies a null-terminated array of 16-bit unicode
 characters. What you're passing is an NSString object.
 So the specifier should be the object specifier, %...@.

Yes, that is what I had tried first.  Still, the warning
comes and goes.
 
 The second is
 error: parse error before JGOXMLParser
 and point to
 [xmlParser setDelegate:JGOXMLParser];
 
 I understand that – loadDataRepresentation:ofType:
 method is valid in 10.3.9 but deprecated in 10.4
 but I have to work with what I have.
 
 Does the delegate have to be an instance?

 It has to be an instance of *something*.

OK, Thanks.

That leaves only, what's the namespaceURI parameter in
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName 
attributes:(NSDictionary *)attributeDict

The examples do not show and the reference says namespaceURI
If namespace processing is turned on, contains the URI for the current 
namespace as a string object. so I'm going to let it be an empty string.

I've submitted comments to the documentation.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSXMLParser and NSDocument

2009-04-30 Thread Marcel Weiher


On Apr 30, 2009, at 12:36 , Jeffrey Oleander wrote:



%S specifies a null-terminated array of 16-bit unicode
characters. What you're passing is an NSString object.
So the specifier should be the object specifier, %...@.


Yes, that is what I had tried first.  Still, the warning
comes and goes.


Then it is something else and not that particular format string.



That leaves only, what's the namespaceURI parameter in
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString  
*)elementName namespaceURI:(NSString *)namespaceURI qualifiedName: 
(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict


The examples do not show and the reference says namespaceURI
If namespace processing is turned on, contains the URI for the  
current namespace as a string object. so I'm going to let it be an  
empty string.


This is the XML namespace and it is a message that is sent to you, so  
you don't get to set the parameter.


Spec:   http://www.w3.org/TR/REC-xml-names/
Tutorial:   http://www.w3schools.com/XML/xml_namespaces.asp

Marcel

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSXMLParser and NSDocument

2009-04-28 Thread Graham Cox


On 29/04/2009, at 8:34 AM, Jeffrey Oleander wrote:


I've been having 2 intermittent compilation errors
on 10.3.9 in
- (BOOL)loadDataRepresentation:(NSData*)data ofType: 
(NSString*)fileType

{
BOOL success;
NSString * lowercaseFileType = [fileType lowercaseString];
NSLog(@fileType=%S, lowercaseFileType);



%S specifies a null-terminated array of 16-bit unicode characters.  
What you're passing is an NSString object. So the specifier should be  
the object specifier, %...@.



[xmlParser setDelegate:JGOXMLParser];




The second is
error: parse error before JGOXMLParser
and point to
[xmlParser setDelegate:JGOXMLParser];

I understand that – loadDataRepresentation:ofType:
method is valid in 10.3.9 but deprecated in 10.4
but I have to work with what I have.

Does the delegate have to be an instance?



It has to be an instance of *something*. JGOXMLParser I'm assuming is  
the name of your class. You can't have static objects in Objective-C  
as you can in C++, so this statement is illegal. If you want your  
class to implement the delegate methods, you could pass [JGOXMLParser  
class], since a class is an object. Or you could instantiate an actual  
JGOXMLParser. The latter sounds by far the less weird of the two  
options.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSXMLParser and NSDocument

2009-04-28 Thread Graham Cox


On 29/04/2009, at 11:51 AM, Graham Cox wrote:


You can't have static objects in Objective-C



Correction - I meant to say *stack* objects...

--G.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com