• 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: How to add a DOCTYPE declaration to an NSXMLDocument?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add a DOCTYPE declaration to an NSXMLDocument?


  • Subject: Re: How to add a DOCTYPE declaration to an NSXMLDocument?
  • From: Bruce Sharpe <email@hidden>
  • Date: Wed, 31 Mar 2010 00:36:06 -0700

> Doing either of these would have led you to the setName: method, which I suspect is what you're after here.

Sounds promising, but the document type declaration doesn't get
written out to file.  I create the document like this:

NSXMLDocument *myDoc = [[NSXMLDocument alloc]
initWithRootElement:[NSXMLElement elementWithName:@"myDocType"]];
NSXMLDTD *myDTD = [[NSXMLNode alloc] initWithKind:NSXMLDTDKind];
[myDTD setName:@"myDocType"];
[myDoc setDTD:theDTD];

and write it like this (after adding several elements to it):

NSData *myData = [myDoc XMLDataWithOptions:NSXMLNodePrettyPrint];
[myData writeToFile:aPath atomically:YES];

Other XML documents, ones I don't create but get from somewhere else,
show the doctype declaration when I run them through the same write
routine.

To add further to the confusion, if I do this, I do see the doctype
declaration in the output:

NSLog(@"%@", myDoc);

Any suggestions would be appreciated.

Bruce
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to add a DOCTYPE declaration to an NSXMLDocument?
      • From: Bruce Sharpe <email@hidden>
References: 
 >Re: How to add a DOCTYPE declaration to an NSXMLDocument? (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Adding fixed position subview over a scrollview
  • Next by Date: Re: How to add a DOCTYPE declaration to an NSXMLDocument?
  • Previous by thread: Re: How to add a DOCTYPE declaration to an NSXMLDocument?
  • Next by thread: Re: How to add a DOCTYPE declaration to an NSXMLDocument?
  • Index(es):
    • Date
    • Thread