Dom 解析器和 Xerces 解析器的区别 [英] Difference between Dom parser and Xerces Parser

查看:44
本文介绍了Dom 解析器和 Xerces 解析器的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,谁能告诉我,Dom parser"和Xerces Parser"有什么区别.两者的优缺点是什么.

Hey, can anyone please tell me, what are difference between "Dom parser" and "Xerces Parser". What are the advantage and Disadvantages of either.

推荐答案

Xerces DOM 解析器.它是 Java 或 C++ 中的 Apache 实现.

Xerces is a DOM parser. It's the Apache implementation in Java or C++.

您要考虑的两个是 SAX 和 DOM.DOM 在内存中创建一个对象树;SAX 没有.DOM 解析完成后,您可以操作对象树;SAX 使用事件模型来动态处理 XML.

The two you want to think about are SAX and DOM. DOM creates an object tree in memory; SAX does not. You can manipulate the object tree after the DOM is done parsing; SAX uses an event model to process XML on the fly.

SAX 或 DOM 都可以工作".您的选择通常取决于您是否将其保留在内存中以操作或处理它.如果 XML 流是千兆字节,您可能无法一次全部存储它.在这种情况下,SAX 是一个不错的选择,因为您可以在解析时即时使用它.

Either SAX or DOM will "work". Your choice is usually based on whether or not you'll keep it in memory to manipulate it or process it in place. If the XML stream is gigabytes, you might not be able to store it all at once. In that case, SAX is a good choice because you can work with it on the fly as you parse.

Google 是您的朋友:启动它以了解 DOM4J 和 JDOM.

Google is your friend: Fire it up to learn about DOM4J and JDOM.

如果您正在编写 Java,我会推荐 JDOM.它处理了很多样板文件.

I'd recommend JDOM if you're writing Java. It takes care of a lot of the boilerplate stuff.

这篇关于Dom 解析器和 Xerces 解析器的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆