SAX DOM parsing xml

1 acquires the XML file absolute path
2, new new BookHandle BookHandle H = ();
. 3, the SAXParserFactory SAXParserFactory.newInstance Factory = ();
. 4, the SAXParser factory.newSAXParser P = ();

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

Reproduced in: https: //my.oschina.net/yourpapa/blog/621604

Guess you like

Origin blog.csdn.net/weixin_33873846/article/details/92033259