Question

I create XML file successful but it not contains first line :

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

This code is :

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];

}

I don't know why? Do you have suggestion? Thanks in advance

Was it helpful?

Solution

Probably you should try to set this data using next methods:

setCharacterEncoding:
setStandalone:
setVersion:

See NSXMLDocument reference for details

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top