thndrkiss
thndrkiss

Reputation: 4595

suppress namespace prefixes on nsxmlparser

my xml data has nodes in this format . I want to suppress the prefixes, that is when i pull the element name in nsxmlparser's delegate method it should not return as "yyy" and not as "xxx:yyy"

I tries to do this

[parser setDelegate:self];
[parser setShouldProcessNamespaces:NO];
[parser setShouldReportNamespacePrefixes:NO];

this code did not had any effect. what has to be done?

Upvotes: 1

Views: 528

Answers (2)

thndrkiss
thndrkiss

Reputation: 4595

[parser setDelegate:self];
[parser setShouldProcessNamespaces:YES];
[parser setShouldReportNamespacePrefixes:NO];

i got it . . should change the 2nd line to YES.

Upvotes: 4

Praveen S
Praveen S

Reputation: 10393

In your

- (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict

you can probably use

[attributeDict objectForKey:@"xx"]; to get yyy

Upvotes: 0

Related Questions