Phong Nguyen
Phong Nguyen

Reputation: 277

XMLReader issues while parse XML Object

I'm trying to use XMLReader from XMLReader to apply in my project. But I face to to an issue, that I can't fix this bug. Here is my implementation. I design an architecture for it included processes and task. Each process has individual tasks connect together. Right here is transform task, which receive an GDataXMlDocument from previous task to handle next.

ResponseMessage* response = [super execute:request];
    // To do task here
    //
    GDataXMLDocument *docObject = [[request getMessage:@"documentObject"] messageData];
    NSString *content = [[docObject rootElement] XMLString];
    NSLog(@"%@", [[docObject rootElement] XMLString]);
    NSError *error = nil;
    NSDictionary *dictionaryXML = [XMLReader dictionaryForXMLString:[[docObject rootElement] XMLString] error:&error];

And small part of XML object:

<IposDocument xmlns="http://www.csc.com/integral/ipos-common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ipos-prospect="http://www.csc.com/integral/ipos-prospect"><Header><DocType/><DocId/><Version/><Validate/><IsValidateSuccess/><ClientDate/></Header><Data><ipos-prospect:Prospect vpms-suffix="Prospect"><ipos-prospect:Person vpms-suffix="Person"><ipos-prospect:FirstName vpms-suffix="FirstName" visible="1" mandatory="1" editable="1" default="" validate="" prefix="prospect.person.firstName."/><ipos-prospect:MiddleName vpms-suffix="MiddleName" visible="1" mandatory="0" editable="1" default="" validate="" prefix="prospect.person.middleName."/>

But XMLReader can't parse this object and always return nil. I don't know why althought debug it a dozen times. Any help is appreciate. Thank you very much.

Upvotes: 0

Views: 144

Answers (1)

KerrM
KerrM

Reputation: 5240

It appears your XML is invalid. This document defines XML in its entirety. There are tools online to help you validate your XML files.

Upvotes: 1

Related Questions