creating XML using GDataXML in Objective C

138 views Asked by At

I want to create a xml in this format using GDataXml.

<Response>
    <Question Number ="1" OptionID="4" Comments=""/>
    <Question Number ="2" OptionID="3" Comments=""/>
    <Question Number ="3" OptionID="5" Comments=""/>
    <Question Number ="4" OptionID="6" Comments=""/>
</Response>

Please help!!. I quite novice in Objective C

1

There are 1 answers

2
GyanPrakash Satapathy On

I found a solution.i followed this link

https://github.com/skjolber/xswi

My code is

XMLWriter* objXmlWriter = [[XMLWriter alloc]init];

 [objXmlWriter writeStartDocumentWithEncodingAndVersion:@"UTF-8" version:@"1.0"];
[objXmlWriter writeStartElement:@"Response"];
[objXmlWriter writeStartElement:@"Question"];
[objXmlWriter writeAttribute:@"Number" value:@"52"];
[objXmlWriter writeAttribute:@"OptionID" value:@"2"];
[objXmlWriter writeAttribute:@"Comments" value:@"Test "];
[objXmlWriter writeEndElement];
[objXmlWriter writeEndElement];
[objXmlWriter writeEndDocument];

`