Getting NSXMLDTD to initialize
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