use SAX, which is single parse without building up the tree structure, 500M xml probably will bring DOM... (not enough memory)... also, there are many many versions of DOM, SAX for java, check them yourself. :D
or use JAXB to get flexibility of DOM and performance of SAX.
【在 e***g 的大作中提到】 : depends on what you want to do after parse. don't use SAX unless you : have to, it's more work.
e*g
5 楼
is it mature/popular yet? haven't heard of it for a while. well it may not fit, if he wants to search by xpath, or to modify xml. there's is no THE solution, it depends on what he wants to do.
【在 g*s 的大作中提到】 : or use JAXB to get flexibility of DOM and performance of SAX.
g*s
6 楼
still not mature? I used it two years ago for content conversion. did not pay attention afterwards.hehe
【在 e***g 的大作中提到】 : is it mature/popular yet? haven't heard of it for a while. : well it may not fit, if he wants to search by xpath, or to modify xml. : there's is no THE solution, it depends on what he wants to do.
w*c
7 楼
It's an issue of the context. SAX is used for simplicity and speed, while DOM is used for flexibility. If ur source is scanned only once, which is true in most massive data processing, SAX is good enuf.
【在 e***g 的大作中提到】 : depends on what you want to do after parse. don't use SAX unless you : have to, it's more work.
m*c
8 楼
In general, if you are going to manipulate XML, you probably want to use DOM so that you can insert/delete/update node in the DOM tree. If you are going to parse XML only without any manipulation, you can use either DOM or SAX, but SAX is faster comparing to DOM and uses less memory. In your case, you may have to use SAX unless you have a lot memory. DOM
【在 w********c 的大作中提到】 : It's an issue of the context. SAX is used for simplicity and speed, while DOM : is used for flexibility. If ur source is scanned only once, which is true in : most massive data processing, SAX is good enuf.