I am wanting to know how to add text from a variable into an xml writer.
This is what I am trying to do below
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];
so pretty much how you do an nslog.. but i would like to know how i can do this with xmlwriter.. or if its even possible?
otherwise i guess the other option would be to create the whole string outside of the xmlwriter? what do you think?
Try this:
[xmlWriter writeCharacters:[NSString stringWithFormat:@"request: %@ can go in here", testString]]; //this line here