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:@""];
NSXMLDocument *myDoc = [[NSXMLDocument alloc] initWithXMLString:myXMLString
options:0 error:&
> 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
> Sounds promising, but the document type declaration doesn't get written
out to file.
If I create the document using a string instead, it works:
NSString *docString = [NSString stringWithFormat:@""];
NSXMLDocument *myDoc = [[NSXMLDocument alloc] initWithXMLString:docString
options:0 error:&err];
On Wed, Mar 31, 2010 at 7:14 AM, Steven Spencer wrote:
>
> The following code produces the equivalent XML :
>
> NSXMLDocument *myDoc = [[NSXMLDocument alloc]
> initWithRootElement:[NSXMLElement elementWithName:@"myDocType"]];
> NSXMLDTD *myDTD = [[NSXMLDTD alloc] initWithKind:NSXMLDTDKind];
> [my
Good advice, Matt. Comments below.
* Read the documentation properly. For example, a class has a superclass,
> which may contain the methods you're looking for (probably why setName: was
> missed).
>
No, setName was missed because it is a rather non-obvious name (IMHO) for a
method to set the do