I’m trying to get the root element. based on the root element I want to trigger a function.
For exmaple the xml looks like this:
<State>
<Name>California</Name>
<Time>CA Time.</Time>
<Time>CA Time2.</Time>
<Notes>This is a note for California</Notes>
</State>
and the next incoming xml looks like this:
<country>
<Name>USA</Name>
<Time>west coast Time.</Time>
</country>
so based on the the root element i want to trigger the right function. I’m using the current NSXmlparser delegate methods.
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict;
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
but it seems its skipping the the root element. od did i miss any method which can get the the root element first?
Check this out:
And here is a link from apple, always read the documentation and their code examples…
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NSXML_Concepts/NSXML.html#//apple_ref/doc/uid/TP40001263-SW1
I’m not 100% sure, but I think it works…
Accordingly you can make the change for the county.