我想知道如何将文本从变量添加到xml编写器中。
这就是我在下面要做的事情
NSString *testString = [[NSString alloc] initWithString:@"TEST TEST TEST"];
//allocate serializer
id <XMLStreamWriter> xmlWriter = [[XMLWriter alloc] init];
//add root element
[xmlWriter writeStartElement:@"Rows"];
[xmlWriter writeStartElement:@"Row"];
[xmlWriter writeCharacters:@"request: %@ can go in here", testString]; //this line here
[xmlWriter writeEndElement];
//close rows element
[xmlWriter writeEndElement];所以就像你做一个nslog一样。但是我想知道如何使用xmlwriter实现这一点。或者是否有可能呢?
否则,我猜另一种选择是在xmlwriter之外创建整个字符串?你认为如何?
发布于 2012-03-08 08:41:48
试试这个:
[xmlWriter writeCharacters:[NSString stringWithFormat:@"request: %@ can go in here", testString]]; //this line herehttps://stackoverflow.com/questions/9611319
复制相似问题