• 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
Getting NSXMLDTD to initialize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting NSXMLDTD to initialize


  • Subject: Getting NSXMLDTD to initialize
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 9 Nov 2005 15:28:46 -0600

I have the following DTD:
======
<!ELEMENT kanjitime (movie*)>
<!ELEMENT movie (mark*)>
<!ATTLIST movie
    name    CDATA   #REQUIRED
    scale   CDATA   #DEFAULT "600"
    >
<!ELEMENT mark (#PCDATA)>
<!ATTLIST mark
    time    CDATA   #REQUIRED
    >
======

... which I hope to use in an XML document I am creating with 10.4's NSXMLDocument family of classes. I can't seem to get an initialized instance of NSXMLDTD from this input, whether from a URL pointing to the DTD file in my resource directory, or from the data in-memory:

======
NSString * dtdPath = [[NSBundle mainBundle] pathForResource: @"kanjitime"
ofType: @"dtd"];
NSAssert(dtdPath, @"The DTD should be in the resources folder.");
NSURL * dtdURL = [NSURL fileURLWithPath: dtdPath];
NSError * error;


#if 0
  sKanjitimeDTD = [[NSXMLDTD alloc] initWithContentsOfURL: dtdURL
									options: NSXMLNodeOptionsNone
									error: &error];
#else
  NSData *		data = [NSData dataWithContentsOfFile: dtdPath];
  sKanjitimeDTD = [[NSXMLDTD alloc] initWithData: data
                                         options: 0
                                           error: &error];
#endif
======

In either case error is returned as nil (indicating no error), but the instance variables of sKanjitimeDTD are all zero/uninitialized. The DTD responds to all messages seeking information or structure with nil, and associating the DTD with an NSXMLDocument produces a document with an empty <DOCTYPE > element.

Obviously, I'm missing something -- I'm willing to accept that it's something boneheaded with my DTD. What is it?

	-- F

_______________________________________________
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: Getting NSXMLDTD to initialize
      • From: Will Mason <email@hidden>
  • Prev by Date: Re: Pb with object release
  • Next by Date: Re: Getting NSXMLDTD to initialize
  • Previous by thread: Re: Single tabview item appears off center
  • Next by thread: Re: Getting NSXMLDTD to initialize
  • Index(es):
    • Date
    • Thread