Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我知道 StAX 是一个拉式解析...但我想知道是否有可能保存根光标位置/上下文..访问子光标...然后将根光标倒回到保存的位置/上下文?
谢谢
不,在 Stax API 或 Woodstox 的扩展 API (stax2-api) 中不支持这样做。
如果有帮助,您可以使用XMLEventReader, 存储事件。它仍然比重新解析更有效,尽管它使用的内存比仅仅保留底层 XML 内容要多。
XMLEventReader