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

How to add a DOCTYPE declaration to an NSXMLDocument?


  • Subject: How to add a DOCTYPE declaration to an NSXMLDocument?
  • From: Bruce Sharpe <email@hidden>
  • Date: Sat, 27 Mar 2010 16:59:35 -0700

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?
_______________________________________________

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

  • Prev by Date: How to get wifi information
  • Next by Date: Custom NSTextView for text annotations
  • Previous by thread: Re: How to get wifi information
  • Next by thread: Re: How to add a DOCTYPE declaration to an NSXMLDocument?
  • Index(es):
    • Date
    • Thread