开发者

removing a tag from xml generated by nspropertyllist seralization

开发者 https://www.devze.com 2023-03-30 14:46 出处:网络
i have a dictionary called root dictionary and using the propertylist seralization i just converted it into xml format

i have a dictionary called root dictionary and using the propertylist seralization i just converted it into xml format

 id plist = [NSPropertyListSerialization dataFromPropertyList:(id)rootObj
                                                          format:NSPropertyListXMLFormat_v1_0 errorDescription:nil];

NSString *plistString = [[NSString alloc] initWithData:plist encoding:NSUTF8St开发者_如何学GoringEncoding];
NSLog(@"the plist is: %@", plistString);

and the out put is as follows

2011-08-21 23:32:49.324 so7143762iPhone[5474:207] the plist is: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Lincoln</key>
    <dict>
        <key>DOB</key>
        <date>1809-02-12T09:18:00Z</date>
        <key>Name</key>
        <string>Abraham Lincoln</string>
        <key>Scores</key>
        <array>
            <integer>8</integer>
            <real>4.9000000953674316</real>
            <integer>9</integer>
        </array>
    </dict>
    <key>Washington</key>
    <dict>
        <key>DOB</key>
        <date>1732-02-17T01:32:00Z</date>
        <key>Name</key>
        <string>George Washington</string>
        <key>Scores</key>
        <array>
            <integer>6</integer>
            <real>4.5999999046325684</real>
            <integer>6</integer>
        </array>
    </dict>
</dict>
</plist>

but i dont want to display the

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

can any one please tell me is it possible or not if it is possible please tell me how to do that ....

thanks in advance ......


The DOCTYPE declaration is a perfectly standard piece of XML and I can't think of a good reason you should want to remove it. Many XML documents contain one, and all XML readers will be able to handle it just fine. This is the standard XML plist format.

0

精彩评论

暂无评论...
验证码 换一张
取 消