我想使用GDataXml以这种格式创建一个xml。
<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>
请帮助!!我在Objective C中非常新手
答案 0 :(得分:0)
我找到了一个解决方案。我跟着这个链接
https://github.com/skjolber/xswi
我的代码是
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];
`