DOM解析

//创建解析工厂

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

//创建解析器实例

DocumentBuilder db = factory.newDocumentBuilder();

//生成doc

doc = db.parse(filename);

//获得节点

doc.getElementsByTagName("*")

推荐阅读更多精彩内容