• 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
Parsing XML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Parsing XML


  • Subject: Parsing XML
  • From: Mark Dawson <email@hidden>
  • Date: Fri, 1 Apr 2005 16:03:07 -0800

I've saved out my document as an XML file correctly, as far as I can tell (although the error, list below happens, it SEEMs like a well-formed line) I'm having problems reading it back in, though. The problem has to do with a saved array of objects. The objects "write" themselves out correctly, by implementing the "- (NSString *)description" method (returning "{1, 1}" type values-- #, #). However, I'm not sure how to read the array back in.

The code I started with does:

- (NSDictionary *)myDocumentDictionaryFromData:(NSData *)data {
NSString *string = [[NSString allocWithZone:[self zone]] initWithData:data encoding:NSASCIIStringEncoding];
NSDictionary *doc = [string propertyList];

the [string propertyList]; line is the one that errors with the array descriptors (in the console, I get a "XML parser error:
Unexpected character { at line 1
Old-style plist parser error:
Expected terminating ')' for array at line 19" for the line:
Points = ({199, 148}, {90, 219}, {196, 273}, {270, 222});

What I don't know how to do is tell the parser how to deal with the key "Points". I've written a parser for the object (converting the {199, 148} back into an NSPoint), but I don't know how to get it invoked…

Thanks for any suggestions,

Mark
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Parsing XML
      • From: Frank Midgley <email@hidden>
  • Prev by Date: Re: U3D File Format
  • Next by Date: Re: multiple keys for object?
  • Previous by thread: Re: U3D File Format
  • Next by thread: Re: Parsing XML
  • Index(es):
    • Date
    • Thread