无需构建 DOM 即可进行 XML 转换
Apache 的(或其他)Java 库是否包含 org.xml.sax.ContentHandler 的实现,该实现仅生成 SAX 事件指示的 XML?
最好是在一个可通过开源代码、可扩展性或用于添加行为的挂钩进行定制的类中完成。
Do any of Apache's (or other) Java libraries include an implementation of org.xml.sax.ContentHandler that simply generates the XML indicated by the SAX events?
Preferably, this would be done in a class which is customizable either through open source code, extensibility, or hooks for adding behavior.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是,如果您有一个
SAXSource
和一个StreamResult
并执行身份转换,您基本上会得到您想要的东西(尽管隐藏在相当难以理解的代码后面)。无论如何,这是我对问题标题的解释。My guess is that if you have a
SAXSource
and aStreamResult
and perform an identity transformation, you basically get what you want (although hidden behind quite impenetrable code). This is my interpretation of the question title, anyway.org.apache.xml.serialize.XMLSerializer(在标准 JDK 中以 com.sun.org.apache.xml.internal.serialize.XMLSerializer 形式提供)是否满足您的需求?
Does
org.apache.xml.serialize.XMLSerializer
(available in the standard JDK ascom.sun.org.apache.xml.internal.serialize.XMLSerializer
) cover your needs?