• 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 10:39:07 -0700

On Wed, Mar 31, 2010 at 7:14 AM, Steven Spencer <email@hidden> wrote:

>
> The following code produces the equivalent XML :
>
> NSXMLDocument *myDoc = [[NSXMLDocument alloc]
> initWithRootElement:[NSXMLElement elementWithName:@"myDocType"]];
> NSXMLDTD *myDTD = [[NSXMLDTD alloc] initWithKind:NSXMLDTDKind];
> [myDTD setName:@"myDocType"];
> [myDoc setDTD:myDTD];
> [myDoc setVersion:@"1.0"];
> [myDoc setCharacterEncoding:@"UTF-8"];
>
> [[myDoc XMLData] writeToFile:[@"~/Desktop/TestXML.xml"
> stringByExpandingTildeInPath] atomically:YES];
>

 Thanks, Steve.  That's much cleaner than my code and works well.  (For
posterity, I changed NSXMLNode to NSXMLDTD in the above so it would be even
more beautiful. :)

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

References: 
 >Re: How to add a DOCTYPE declaration to an NSXMLDocument? (From: Steven Spencer <email@hidden>)

  • Prev by Date: NSComboBoxCell menu selection in an NSTableColumn
  • Next by Date: Re: Best book for learning Objective c and cocoa
  • 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