NSData *data = [mURLHandle resourceData]; // if foreground, this will block 'til loaded.
CFXMLTreeRef cfXMLTree;
cfXMLTree = CFXMLTreeCreateFromData(kCFAllocatorDefault, (CFDataRef)data, NULL, kCFXMLParserSkipWhitespace, kCFXMLNodeCurrentVersion);
{
CFXMLTreeRef xmlTreeNode;
CFXMLNodeRef xmlNode;
int childCount;
int index;
CFXMLElementInfo *docInfoPtr;
NSDictionary* attributes;
NSString* value;
NSComparisonResult checkAlert;
// Get a count of the top level node’s children.
childCount = CFTreeGetChildCount(cfXMLTree);
// Print the data string for each top-level node.
for (index = 0; index < childCount; index++) {
xmlTreeNode = CFTreeGetChildAtIndex(cfXMLTree, index);
xmlNode = CFXMLTreeGetNode(xmlTreeNode);
value = (NSString*) CFXMLNodeGetString(xmlNode);
checkAlert = [value caseInsensitiveCompare:gAlertXMLTagStr];
if (checkAlert == NSOrderedSame) {
docInfoPtr = (CFXMLElementInfo*)CFXMLNodeGetInfoPtr(xmlNode);
attributes = (NSDictionary*)docInfoPtr->attributes;
value = [attributes objectForKey:gAlertXMLAttrStr];
}
}
}