使用 Location 对象插入 XMLEvent
有没有办法在使用 XMLEventReader
读取的另一个 XMLEvent
位置处使用 XMLEventWriter
写入 XMLEvent
?
谢谢,
Is there a way to write XMLEvent
using XMLEventWriter
at the location of another XMLEvent
read using XMLEventReader
?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,您无法使用
XMLReader
就地编辑 XML 文件。您可以通过将所有事件从 XMLReader 直接发送到 XMLWriter 来将整个 XML 复制到输出文件(或流)。然后,您可以动态创建自己的XMLEvent
并在适当的时间将它们提供给XMLWriter
,它们将显示在新文档中。As far as I know, you cannot edit an XML file in-place using
XMLReader
. You can copy the entire XML to an output file (or stream) by sending all events from anXMLReader
directly to anXMLWriter
. You can then create your ownXMLEvent
s on the fly and feed them to theXMLWriter
at the appropriate time and they will show up in the new document.