可以使用DOM或SAX分析器
关于它们的用法,还是看文档吧
import org.w3c.dom.*;
import org.xml.sax.*;