当我在输入和输出为 SAX 的上下文中解析 XSLT 时,是否会在幕后创建 DOM 树?
这是我引用的示例代码:
http://xml.apache.org/ xalan-j/usagepatterns.html#sax
首先,请注意在此代码中所有可以基于 SAX 的内容都是基于 SAX 的:输入和输出。
另外,请注意,transformerHandler 对象是根据“foo.xsl”创建的,并且transformerHandler 用于执行从SAX 输入到创建输出的SAX ContentHandler 的转换。
我知道 XSLT 需要构建 DOM 树之类的东西才能完成其工作。
所以这是我的问题:我想知道 TransformerHandler 是否真的在幕后构建类似 DOM 树的东西?如果是的话,这岂不是违背了努力留在 SAX 土地上的初衷吗?
Here is example code I am referring to:
http://xml.apache.org/xalan-j/usagepatterns.html#sax
First, notice that everything that can be SAX-based is SAX-based in this code: both the input and the output.
Also, notice that a transformerHandler object is created off of "foo.xsl" and that transformerHandler is used to do a transformation from the SAX input to the SAX ContentHandler that creates the output.
I had understood that XSLT requires something like a DOM tree to be built in order for it to do its work.
So here is my question: I wonder if the transformerHandler is actually building something like a DOM tree behind the scenes? If it is, doesn't that kind of defeat the purpose of trying so hard to stay in SAX-land?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
引用自 http://xml.apache.org/xalan-j/dtm.html< /a>
换句话说,它并不构建 DOM 树,而是构建一个特别适合满足 XSLT 需求的高效结构。
Quoting from http://xml.apache.org/xalan-j/dtm.html
In other words, it doesn't build a DOM tree but it builds an efficient structure that is specially suited to meet the needs of XSLT.