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

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

  • Follow-Ups:
    • Re: Getting NSXMLDTD to initialize
      • From: Fritz Anderson <email@hidden>
References: 
 >Getting NSXMLDTD to initialize (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Getting NSXMLDTD to initialize
  • Next by Date: CoreData Threading docs/advice?
  • Previous by thread: Getting NSXMLDTD to initialize
  • Next by thread: Re: Getting NSXMLDTD to initialize
  • Index(es):
    • Date
    • Thread