【发布时间】:2016-03-10 17:53:30
【问题描述】:
是否可以直接使用 StAX 编写 xml 块?
我知道我可以将XMLStreamWriter 与writeStartElement、writeCharacters 和writeEndElement 一起使用,但xml 字符串没有灵活性。
考虑到我必须编写一个大的 xml 文件 (> 100 MB),我该如何解决这个限制。
我有像这样的任意 xml 字符串,有时结构相当复杂,需要与其他一些细节一起添加以形成最终的 xml 文件。这只是一个示例,不是实际的 xml 字符串。
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>
Light Belgian waffles covered with strawberries and whipped cream
</description>
<calories>900</calories>
</food>
【问题讨论】: