Re: Getting NSXMLDTD to initialize
Re: Getting NSXMLDTD to initialize
- Subject: Re: Getting NSXMLDTD to initialize
- From: Will Mason <email@hidden>
- Date: Wed, 9 Nov 2005 13:49:16 -0800 (PST)
Doesn't the DTD need to be bracketed with the name of its DOCTYPE?, like:
<!DOCTYPE NameOfYourDocType
[
>>> Your element info here
]>
What you presented as your DTD does not look valid to me.
----- Original Message ----
From: Fritz Anderson <email@hidden>
To: Cocoa-Dev List <email@hidden>
Sent: Wed Nov 9 15:28:46 2005
Subject: Getting NSXMLDTD to initialize
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
_______________________________________________
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