• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie Error on Loading XML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie Error on Loading XML


  • Subject: Re: Newbie Error on Loading XML
  • From: Devon Ferns <email@hidden>
  • Date: Mon, 11 Aug 2008 13:27:28 -0400

You're missing some parameters for initWithContentsOfURL
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSXMLDocument_Class/Reference/Reference.html#//apple_ref/occ/instm/NSXMLDocument/initWithContentsOfURL:options:error:>

The full method signature is
- (id)initWithContentsOfURL:(NSURL *)url options:(NSUInteger)mask error:(NSError **)error


Devon

Matt Keyes wrote:
Hello,

I am trying to load an XML file from the project, and here is what I do:

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MyXmlFile" ofType:@"Xml"]];
NSXMLDocument *xmlDoc = nil;
@try {
xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:url];
}
@catch (NSException * e) {
txtResult.text = [NSString stringWithFormat:@"Error: %@", [e reason]];
}
@finally {
}
if(xmlDoc != nil)
{
//... do stuff
}


The error I receive is:

"-[NSXMLDocument initWithContentsOfURL]: unrecognized selector sent to instance 0x471100"

I was able to load a NSData object from the XML file and I can capture the file path in a string from the NSBundle resource path and it is correct.  I get this same error if I use the initWithData function for the NSXMLDocument object.

Any ideas?

Thanks,
Matt

_________________________________________________________________
Your PC, mobile phone, and online services work together like never before.
http://clk.atdmt.com/MRT/go/108587394/direct/01/_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Newbie Error on Loading XML (From: Matt Keyes <email@hidden>)

  • Prev by Date: RE: Newbie Error on Loading XML
  • Next by Date: Re: Miniaturizing a window when PowerPoint is in full screen mode
  • Previous by thread: RE: Newbie Error on Loading XML
  • Next by thread: Newbie Question on "self"
  • Index(es):
    • Date
    • Thread