0

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!

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
JMLdev
  • 846
  • 2
  • 10
  • 21

1 Answers1

1

Try to use setStringValue:. So for example:

[element setStringValue:myVal];

Hope that helps.

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190