iOS XML writer class

后端 未结 4 1283
悲&欢浪女
悲&欢浪女 2021-01-12 08:38

I want to create a game, that will use a level system. So i want to store my levels and to be able to change them during the game (to save the state). So i decided to use XM

4条回答
  •  花落未央
    2021-01-12 09:32

    Try the open source XML stream writer for iOS:

    • Written in Objective-C, a single .h. and .m file
    • One @protocol for namespace support and one for without

    Example:

    // allocate serializer
    XMLWriter* xmlWriter = [[XMLWriter alloc]init];
    
    // start writing XML elements
    [xmlWriter writeStartElement:@"Root"];
    [xmlWriter writeCharacters:@"Text content for root element"];
    [xmlWriter writeEndElement];
    
    // get the resulting XML string
    NSString* xml = [xmlWriter toString];
    

    This produces the following XML string:

    Text content for root element
    

提交回复
热议问题