• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: plist <key><value> not matching
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: plist <key><value> not matching


  • Subject: Re: plist <key><value> not matching
  • From: Jean-François Veillette <email@hidden>
  • Date: Wed, 22 Sep 2004 10:01:26 -0400

1- there is a bug in the wo .plist reader (the cocoa .plist reader I suspect is ok), which read all values as String and not as the type suggested. If you want object types in your .plist-like file to work as advertised, use WOXMLCoder / WOXMLDecoder. I switched from .plist to .xml for that exact reason. To get the correct xml syntaxt, I created a sample dictionary in memory, then used woxmlcoder to get the .xml. At that point, I was able to write / add stuff to the file with correct syntax.

2- compare objects with .equals() not pointer equality ( == ). Only basic types (int, float) can be compared with '=='.

- jfv

Le 04-09-22, à 09:33, Erwin a écrit :

I have a plist file in my WO app with the following structure :

</key>
<array>
<dict>
</key>
</string>
</key>
</integer>
</dict>
<dict>
</key>
Twenty Five </string>
</key>
</integer>
</dict>
<dict>
</key>
Fifty </string>
</key>
</integer>
</dict>
<dict>
</key>
Hundred </string>
</key>
</integer>
</dict>
........

</array>
.....


I use the 'displayValue' to display string in a popup button.

Given an Integer variable (aValue) I tried to search for the displayValue with the following method :

public NSDictionary lowerLimitPrice(Integer aValue) {
NSDictionary _lowerLimitPrice = null;
java.util.Enumeration enumerator = lowerLimitPricesArray().objectEnumerator();
while (enumerator.hasMoreElements()) {
_lowerLimitPrice = (NSDictionary) enumerator.nextElement();
if (_lowerLimitPrice.valueForKey("value") == aValue) { return _lowerLimitPrice; }
}
return _lowerLimitPrice;
}
There is never a match as _lowerLimitPrice.valueForKey("value") is always seen as a String (?) in the debugger.
Sure I could use only strings in the plist and use aValue.toString() to compare them (it runs..) but why is it possible to specify <integer> in the plist ? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >plist <key><value> not matching (From: Erwin <email@hidden>)

  • Prev by Date: plist <key><value> not matching
  • Next by Date: RE: Catching Bounced emails with WebObjects
  • Previous by thread: plist <key><value> not matching
  • Next by thread: Sorting question
  • Index(es):
    • Date
    • Thread