最近开发中遇到一个需求,在post请求中,需要传递xml的参数!瞬间感觉不太好了,常规来说都是上传json的, 无奈也只能按照接口文档来做了!
查阅大量资料,KissXML 这个开源框架可以完美解决该问题, 下面粘出实现代码:
- (void)getSkuXmlWithVArray:(NSMutableArray *)vArray pArray:(NSMutableArray *)pArray
{
DDXMLElement *AttributesElement = [DDXMLElement elementWithName:@"Attributes"];
for (NSInteger i = 0; i < pArray.count; i++) {
DDXMLElement *ProductAttributeElement = [DDXMLElement elementWithName:@"ProductAttribute"];
[ProductAttributeElement addAttribute:[DDXMLNode attributeWithName:@<