Java 怎么获取XML文档生成器(DocumentBuilder)

2019年7月29日19:16:26Java 怎么获取XML文档生成器(DocumentBuilder)已关闭评论 421 471字阅读1分34秒

1.简介

Java 怎么获取XML文档生成器(DocumentBuilder)?——请看下文。

2.示例代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */



import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

public class Main {
    public static DocumentBuilder getDocumentBuilder() {
        DocumentBuilder documentBuilder = null;

        try {
            DocumentBuilderFactory documentBuilderfactory = DocumentBuilderFactory
                    .newInstance();
            documentBuilder = documentBuilderfactory.newDocumentBuilder();
        } catch (Exception exception) {
        }

        return documentBuilder;
    }
}

 
编程十万个怎么办