Hi Thanks for the help. I did not receive any message from Sean, but your 
comments lead me in the right direction.

First I changed xmlData to:

        NSData * xmlData = [NSData dataWithContentsOfFile: filePath]; 

Next I had a syntax error when declaring my NSArray and like you said it was 
pointing to an empty array:

        NSArray* result = [NSArray arrayWithArray:PerformXMLXPathQuery(xmlData, 
@"//mynode")];

Final solution:

        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"manifest" 
ofType:@"xml"];         
   NSData * xmlData = [NSData dataWithContentsOfFile: filePath];        
   NSArray* result = [NSArray arrayWithArray:PerformXMLXPathQuery(xmlData, 
@"//mynode")];

As for your last point about learning C, I have picked up 2 books on the 
subject and have been learning.

Thanks again for the help

Phil
        

On Dec 3, 2009, at 10:34 PM, Fritz Anderson wrote:

> On 3 Dec 2009, at 5:40 PM, Philip Vallone wrote:
> 
>>      NSString *filePath = [[NSBundle mainBundle] pathForResource:@"manifest" 
>> ofType:@"xml"];         
>>      NSData* xmlData = [filePath dataUsingEncoding:NSUTF8StringEncoding];
> 
> Separate from Sean's help, sending dataUsingEncoding: to an NSString gets you 
> an NSData that wraps the binary representation of the characters of the 
> string itself. You want something like
> 
>       NSData * xmlData = [NSData dataWithContentsOfFile: filePath];
> 
> Also:
>>      NSArray *resultNodes = [NSArray array];
> 
> This points the variable resultNodes at an empty NSArray, which you will not 
> be able to change.
> 
>> warning: implicit declaration of function 'PerformXPathQuery'
> 
> This indicates that you use of PerformXPathQuery was the first time the 
> compiler has ever seen that function. It is universal practice to declare 
> functions in advance, usually in a header (.h) file imported into the source 
> file. It helps the compiler generate correct code and warn you about 
> potential errors.
> 
> This last point is kind of basic to C. If you're not used to C, you shouldn't 
> be starting with Objective-C, Cocoa, and libxml. Take a couple of weeks, back 
> off, and learn C and its standard libraries first.
> 
>       — F
> 

_______________________________________________

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

Reply via email to