From 33467093c14074d1399dd4af0d1c633a24cfd609 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 9 Apr 2014 18:03:33 -0400 Subject: [PATCH] Fix for #2695 --- ActiveSync/NGDOMElement+ActiveSync.m | 35 ++++++++++++++++++++++++---- NEWS | 1 + 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/ActiveSync/NGDOMElement+ActiveSync.m b/ActiveSync/NGDOMElement+ActiveSync.m index 527486605..421db0a3c 100644 --- a/ActiveSync/NGDOMElement+ActiveSync.m +++ b/ActiveSync/NGDOMElement+ActiveSync.m @@ -37,6 +37,28 @@ static NSArray *asElementArray = nil; @implementation NGDOMElement (ActiveSync) +- (BOOL) isTextNode +{ + id children; + id element; + int i; + + if ([self nodeType] == DOM_TEXT_NODE) + return YES; + + children = [self childNodes]; + + for (i = 0; i < [children length]; i++) + { + element = [children objectAtIndex: i]; + + if ([element nodeType] != DOM_TEXT_NODE) + return NO; + } + + return YES; +} + // // We must handle "inner data" like this: // @@ -96,9 +118,13 @@ static NSArray *asElementArray = nil; tag = [element tagName]; count = [(NSArray *)[element childNodes] count]; - + + if ([element isTextNode]) + { + value = [element textValue]; + } // Handle inner data - see above for samples - if (count > 2) + else { NSMutableArray *innerElements; id innerElement; @@ -144,12 +170,11 @@ static NSArray *asElementArray = nil; value = nil; } } - else - value = [[element firstChild] textValue]; if (value && tag) [data setObject: value forKey: tag]; - } + + } // if ([element nodeType] == DOM_ELEMENT_NODE) } return data; diff --git a/NEWS b/NEWS index cbb1ec68d..28a1d133a 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ Bug fixes - improved folder rename operations using ActiveSync (#2700) - fixed SmartReply/Forward when ReplaceMime was omitted (#2680) - fixed wrong generation of weekly repetitive events with ActiveSync (#2654) + - fixed incorrect XML data conversion with ActiveSync (#2695) 2.2.3 (2014-04-03) ------------------