• 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
non-portable plist DTD URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

non-portable plist DTD URL


  • Subject: non-portable plist DTD URL
  • From: Scout <email@hidden>
  • Date: Thu, 1 Aug 2002 19:04:02 -0700

Is there a better way to write a cocoa plist?

The problem is with the doctype reference in plist files, pretty non-portable as XML:

<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">

Fortunately cocoa seems to pay no attention to doctype at all, thus if you remove the line in the brutal fashion, the file still works on Mac, and parses on machines with validating XML parsers.

NSMutableDictionary *aDict = [[NSMutableDictionary alloc] init];
[aDict setObject:@"foo value" forKey:@"fooKey"];
[aDict setObject:@"bar value" forKey:@"barKey"];
[aDict writeToFile:@"/tmp/foo" atomically:YES];
{
NSMutableString *d = [NSMutableString stringWithContentsOfFile:@"/tmp/foo"];
NSString *xdtd = @"<!DOCTYPE plist SYSTEM \"file://localhost/System/Library/DTDs/PropertyList.dtd\">";
NSRange r = [d rangeOfString:xdtd];
[d replaceCharactersInRange:r withString:@""];

NSLog(@"Plist Data sans bad doctype reference: %@", d);
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: non-portable plist DTD URL
      • From: Jim Correia <email@hidden>
  • Prev by Date: networking...
  • Next by Date: Re: non-portable plist DTD URL
  • Previous by thread: Re: networking...
  • Next by thread: Re: non-portable plist DTD URL
  • Index(es):
    • Date
    • Thread