SAX DOM解析xml

时间:2016-02-24 21:05:42   收藏:0   阅读:217

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()

原文:http://www.cnblogs.com/gentspy/p/5214270.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!