2010-03-08 49 views

回答

5

要創建包含CDATA編碼文本的節點,請在NSXMLNode上使用方法initWithKind:options:

NSXMLNode *cdataNode = [[NSXMLNode alloc] initWithKind:NSXMLTextKind options:NSXMLNodeIsCDATA]; 
[cdataNode setStringValue:@"<some text>"]; 

並以write xml data to a file

NSData *xmlData = [xmlDoc XMLDataWithOptions:NSXMLNodePrettyPrint]; 
[xmlData writeToFile:fileName atomically:YES]; 
+0

嗨, 感謝您的幫助。它解決了。 – boom 2010-03-08 09:00:07