我正在使用 XMWriter 类生成 XML,但是在生成我的 XML 字符串后,我不确定如何将其保存为 XML 文件。
.m 代码
[xmlWriter writeEndElement];
[xmlWriter writeStartElement:@"Miniparent"];
[xmlWriter writeStartElement:@"Child"];
[xmlWriter writeCharacters:@"Text content for root element"];
[xmlWriter writeEndElement];
[xmlWriter writeStartElement:@"Child"];
[xmlWriter writeCharacters:@"Text content for root element"];
[xmlWriter writeEndElement];
控制台输出
<Miniparent>
<Child>Text content for root element</Child>
<Child>Text content for root element</Child>
<Child>Text content for root element</Child>
</Miniparent>