سؤال

I am working on iOS application and i want to get the namespace of a nsxmlelement.

my NSXMLElement *query has the following value in it.

<query xmlns="jabber:iq:roster" test="this is value">
<item subscription="to" name="test" jid="test@local"/>
</query>

I have used following code to get the xmlns but its not working

         NSLog(@"%@",[query attributeStringValueForName:@"test"]);
         NSLog(@"%@",[query attributeStringValueForName:@"xmlns"]);

Value for test is printed but the value for xmlns shows null

Please let me know how to get the value of xmlns

هل كانت مفيدة؟

المحلول

This is because xmlns is not an attribute. xmlns is a namespace definition. You can get it with [query namespaceForPrefix:nil].stringValue.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top