XML DocumentBuilder#parse(String str)

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();	
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(url);//参数是url,而不是一个xml的字符串
XPathFactory xpathFactory = XPathFactory.newInstance();
XPath xpath = xpathFactory.newXPath();

这个容易被误用。

你可能感兴趣的:(java,xml)