How do I set the doctype when building a document with GDataXML*
When using GDataXML* to build an XML document, how do I set the doctype of the generated X开发者_如何学PythonML? The rough outline of how I'm using GData can be found here:
http://www.raywenderlich.com/725/how-to-read-and-write-xml-documents-with-gdataxml
We ended up doing it this way, which is not ideal but does the trick:
NSMutableString* contentString = [[[NSMutableString alloc] init] autorelease];
[contentString setString: @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"];
[contentString appendString:@"<!DOCTYPE somedoc SYSTEM \"http://x.y.com/some.dtd\">"];
[contentString appendString:@"<somedoc></somedoc>"];
GDataXMLDocument *document = [[[GDataXMLDocument alloc] initWithXMLString:contentString options:0 error:nil] autorelease];
精彩评论