当前位置: 技术问答>java相关
初级错误大家找,解决了就给分!
来源: 互联网 发布时间:2015-06-01
本文导语: import java.io.*; import org.w3c.dom.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; public class ParseXmlTree { DocumentBuilderFactory factory=DocumentBuilderFactory.n...
import java.io.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
public class ParseXmlTree
{
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document doc=builder.parse("test.xml");
doc.normalize(); //此为24行
NodeList list=doc.getElementsByName("people");
for (int i=0;i
import org.w3c.dom.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
public class ParseXmlTree
{
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document doc=builder.parse("test.xml");
doc.normalize(); //此为24行
NodeList list=doc.getElementsByName("people");
for (int i=0;i