public class DocumentUtil extends Object
program: Sinlmao Commons Network Utils
description: Document工具类
create: 2020-06-22 16:46
| 构造器和说明 |
|---|
DocumentUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Document |
buildeDocument()
构建Document对象
|
static Document |
loadDocumentFromFile(String fileName)
从文件全名(含路径)的指向的文件数据转换为Document对象
|
static DocumentBuilder |
newBuilder()
创建DocumentBuilder对象
|
static DocumentBuilderFactory |
newBuilderFactory()
创建DocumentBuilderFactory
|
static Transformer |
newTransformer(String charset,
boolean indent)
创建Transformer对象
|
static Document |
newXMLDocument(Node node)
构建Document带root节点对象
|
static Document |
parseDocument(InputStream input)
InputStream转换为Document对象
|
static Document |
parseDocument(String xml)
XML字符串转换为Document对象
|
static String |
toNodeString(Node node)
Node对象转成字符串
|
static String |
toNodeString(Node node,
String charset)
Node对象转成字符串
|
static String |
toNodeString(Node node,
String charset,
boolean indent)
Node对象转成字符串
|
static String |
toString(Document document)
Document对象转成字符串
|
static String |
toString(Document document,
String charset)
Document对象转成字符串
|
static String |
toString(Document document,
String charset,
boolean indent)
Document对象转成字符串
|
public static Document buildeDocument()
public static Document newXMLDocument(Node node)
node - Node阶段对象public static DocumentBuilder newBuilder() throws ParserConfigurationException
ParserConfigurationException - 异常public static DocumentBuilderFactory newBuilderFactory()
public static Document parseDocument(String xml)
xml - 遵循XML规范的字符串public static Document parseDocument(InputStream input)
input - 输入流public static Document loadDocumentFromFile(String fileName)
fileName - 文件全名(含路径)public static String toString(Document document)
document - Document对象public static String toString(Document document, String charset)
document - Document对象charset - 字符编码public static String toString(Document document, String charset, boolean indent)
document - Document对象charset - 字符编码indent - 是否格式化(缩进、换行等)public static String toNodeString(Node node, String charset)
node - Node对象charset - 字符编码public static String toNodeString(Node node, String charset, boolean indent)
node - Node对象charset - 字符编码indent - 是否格式化(缩进、换行等)public static Transformer newTransformer(String charset, boolean indent)
Copyright © 2021. All rights reserved.