您的位置:首页 > 其它

SAX DOM解析xml

2016-02-24 19:20 357 查看
1 获取XML文件的绝对路径
2,BookHandle h=new BookHandle();
3,SAXParserFactory factory=SAXParserFactory.newInstance();
4,SAXParser p=factory.newSAXParser();

5.p.parse(path,h);

DOM(document object model)解析xml
1 SAXReader reader=new SAXReader();
2 Document doc=reader.read(path);
Element e=doc.getRootEllement();
Iterator it=e.attributeIterator();
Attribute a=(Attribute)it.next();
a.getName();
a.getValue()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: