软件包 javax.xml.parsers
提供允许处理 XML 文档的类。
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class DomTest { public static void main(String[] args) throws ParserConfigurationException { // TODO Auto-generated method stub // 获得工厂实例 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // 获得解析器 DocumentBuilder builder = factory.newDocumentBuilder(); System.out.println(builder); } }
时间: 2024-11-10 20:26:10