Reputation: 846
I'm using GDataXML in iOS and I'm trying to figure out how to change a node's value (i.e. the content of the equivalent element in the original XML file). I have an NSArray
of elements that were returned from an XPath query. However, I can't seem to find the right function to change or set the value. I would basically like to do the following:
for (GDataXMLElement *element in elementArray)
{
[element setValue:myVal];
}
But there's no setValue method available for GDataXMLElement
, nor for GDataXMLNode
. The closest is setValue:forKey
as follows:
[element setValue:myVal forKey:myKey];
But I can't figure out what myKey should be. When I use [element name]
I get the error
"this class is not key value coding-compliant for the key [element name]
I'm totally lost, help please!
Upvotes: 0
Views: 742
Reputation: 33428
Try to use setStringValue:
. So for example:
[element setStringValue:myVal];
Hope that helps.
Upvotes: 1