import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import org.w3c.dom.Attr;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class DomTest
{
public static void main(String[] args)throws Exception
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("student.xml"));<span style="white-space:pre"> </span>//DMO解析文档的前三步:创建简单模式工厂
Element root = doc.getDocumentElement();<span style="white-space:pre"> </span>//得到根元素
<span style="white-space:pre"> </span>
parseElement(root);<span style="white-space:pr