SameSung Vs Iphone
SameSung Vs Iphone

Reputation: 614

Plist with Different Strings options

Is there a way to add string in a plist file from source code?. I want to add two more columns, but when I try to do this Its shows that code is been corrupted. Is there any option to pass more values?. The working code 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">
<array>
<dict>
    <key>title</key>
    <string>Title 1</string>
    //here i want to add one more string(value) how to do so?

    <key>subtitle</key>
    <string>Subtitle 1</string>
    <key>image</key>
    <string>image1.png</string>
</dict>

what i want in plist is ...

Key Type Value value value

<?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">
<array>
<dict>
    <key>title</key>
    <string> 1</string>
    <string> 2 </string> 
     <string> 3</string>
    </dict>
 </Plist>

Upvotes: 1

Views: 576

Answers (1)

Zaphod
Zaphod

Reputation: 7290

Unfortunately dictionaries use the Key/Value paradigm, that means only one value for a given key. But you can set an array containing two strings, for example:

<key>title</key>
<array>
    <string>Title 1</string>
    <string>Title 2</string>
</array>

Upvotes: 5

Related Questions