2
創建XML文件成功的,但它不包含第一行:NSXMLDocument不具有<?XML版本= 「1.0」 編碼= 「UTF-8」 獨立= 「否」?>在可可觸摸
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
此代碼是:
xmlDoc = [[NSXMLDocument alloc] initWithContentsOfURL:url options:NSXMLDocumentTidyXML error:&error];
if(xmlDoc)
{
root = [xmlDoc rootElement];
}
else
{
root = [NSXMLNode elementWithName: @"P2Main"];
[root addAttribute:[NSXMLNode attributeWithName:@"xmlns:xsi" stringValue:@"http://www.w3.org/2001/XMLSchema-instance"]];
[root addAttribute:[NSXMLNode attributeWithName:@"xmlns" stringValue:@"urn:schemas-Professional-Plug-in:P2:ClipMetadata:v3.1"]];
xmlDoc = [[NSXMLDocument alloc] initWithRootElement:root];
}
我不知道爲什麼?你有什麼建議嗎?在此先感謝
感謝它的工作原理 – HTKT611