After a lot of back and forth - we get an error

282 views
Skip to first unread message

AK

unread,
Dec 9, 2009, 3:59:50 PM12/9/09
to KissXML
We have a protocol that generates and parses a lot of XML. Much of it
is one liners back and forth like this:
<?xml version="1.0" encoding="utf-8"?><webissync session="{C13C249B-
DF1A-42CC-8902-EFA1FB94DCF4}" partial="YES"><events type="new"><event
id="7"><title>Kym Birthday</title><location></
location><modified>2009-12-09T01:29:04Z</modified><allDay>YES</
allDay><startTime>1980-01-25T06:00:00Z</
startTime><end>1980-01-27T00:00:00Z</end><status>0</
status><alarmMinutes>0</alarmMinutes><sensitivity>0</
sensitivity><priority>1</priority><note></note><color>#7F0C17</
color><calendar id="3">Calendar</calendar><categories> Birthday</
categories><repeat>3</repeat><recurrence><data>DTSTART;VALUE=DATE:
19800125
DTEND;VALUE=DATE:19800126
RRULE:FREQ=YEARLY;WKST=MO;BYMONTH=1;UNTIL=20100124</data></
recurrence></event></events></webissync>

<?xml version="1.0" encoding="utf-8"?><webissync session="{C13C249B-
DF1A-42CC-8902-EFA1FB94DCF4}">OK</webissync>

Literally hundreds of these kinds of things back and forth. This is
all happening in ASyncSocket calls. So we write data, then read data,
then write, then read, and so on.

Then I always get this at the end:
Error Domain=DDXMLErrorDomain Code=1 "Operation could not be
completed. (DDXMLErrorDomain error 1.)"

I'm GUESSING its a memory issue. Robbie or anyone else - can you give
me some tips on what I might be doing? I've just gone ahead and added
a few more auto-release pools like this:

- (BOOL)_receiveAck:(DDXMLElement* )rootElement
{
NSAutoreleasePool*pool = [NSAutoreleasePool new];
BOOL returnValue = YES;

//setup the root sync
DDXMLElement* resultElement = [rootElement elementForName:@"result"];
if (resultElement)
{
NSString* result = [[resultElement attributeForName:@"status"]
stringValue];
if ([result caseInsensitiveCompare:@"stop"] == NSOrderedSame)
{
NSDictionary* errorDict = [NSDictionary
dictionaryWithObjectsAndKeys:[rootElement elementForName:@"error"],
@"errorElement", nil];
IPSCLog(@"Desktop Sync Error raw xml: %@", rootElement);
[self _error:[NSError errorWithDomain:@"net.webis.sync" code:0
userInfo:errorDict]];

returnValue = NO;
}
}

[pool release];

return returnValue;
}

But I assumed that since this is happening in the runloop that
wouldn't be necessary.

Robbie Hanson

unread,
Dec 22, 2009, 10:15:09 AM12/22/09
to kis...@googlegroups.com
Have you checked the "+ (NSError *)lastError" method in DDXMLNode?

Libxml has a standard error handler method, which is implemented in DDXMLNode. Anytime an error occurs, this error handler is called (theoretically), and we store the error in a Cocoa friendly NSError object. Try printing out this error message next time you see the error.

Let me know if this helps, and what you find.

-Robbie Hanson

> --
>
> You received this message because you are subscribed to the Google Groups "KissXML" group.
> To post to this group, send email to kis...@googlegroups.com.
> To unsubscribe from this group, send email to kissxml+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/kissxml?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages