• 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: Matt Neuburg <email@hidden>
  • Date: Tue, 30 Mar 2010 11:09:02 -0700
  • Thread-topic: How to add a DOCTYPE declaration to an NSXMLDocument?

On Sat, 27 Mar 2010 16:59:35 -0700, Bruce Sharpe <email@hidden>
said:
>I want to add a DOCTYPE declaration to my NSXMLDocument, but can't seem to
>find the right incantation.  The thing that comes closest to working is:
>
>NSString *myXMLString = [NSString stringWithFormat:@"<?xml version=\"1.0\"
>encoding=\"UTF-8\"?><myDocElement></myDocElement>"];
>NSXMLDocument *myDoc = [[NSXMLDocument alloc] initWithXMLString:myXMLString
>options:0 error:&err];
>NSString *myDoctypeString = @"<!DOCTYPE myDocElem>";
>NSXMLDTD *theDTD = [[NSXMLDTD alloc] initWithData:[myDoctypeString
>dataUsingEncoding:NSUTF8StringEncoding] options:nil error:&err];
>[myDoc setDTD:theDTD];
>
>The result should be:
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE myDocElement>
><myDocElement></myDocElement>
>
>but what I get is:
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE >
><myDocElement></myDocElement>
>
>What am I doing wrong?

I can think of two things you might be doing wrong:

(1) You might be failing to consult the documentation for NSXMLNode.

(2) You might be failing to check the archives.

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

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



_______________________________________________

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>
  • Prev by Date: Creating a Virtual (Webcam) Device
  • Next by Date: Re: Mount SMB folders
  • Previous by thread: 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