Package org.miaixz.bus.core.xml
Class XmlWriter
java.lang.Object
org.miaixz.bus.core.xml.XmlWriter
XML生成器
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription获得XML字符串static XmlWriter构建XmlWriterstatic XmlWriter构建XmlWritersetCharset(Charset charset) 设置编码setIndent(int indent) 设置缩进setOmitXmlDeclaration(boolean omitXmlDeclaration) 设置是否输出 xml Declarationvoid将XML文档写出voidwrite(OutputStream out) 将XML文档写出void将XML文档写出void将XML文档写出 格式化输出逻辑参考:https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java
-
Constructor Details
-
XmlWriter
构造- Parameters:
source- XML数据源
-
-
Method Details
-
of
构建XmlWriter- Parameters:
node-NodeXML文档节点或文档本身- Returns:
- XmlWriter
-
of
构建XmlWriter- Parameters:
source- XML数据源- Returns:
- XmlWriter
-
setCharset
设置编码- Parameters:
charset- 编码,null跳过- Returns:
- this
-
setIndent
设置缩进- Parameters:
indent- 缩进- Returns:
- this
-
setOmitXmlDeclaration
设置是否输出 xml Declaration- Parameters:
omitXmlDeclaration- 是否输出 xml Declaration- Returns:
- this
-
getString
获得XML字符串- Returns:
- XML字符串
-
write
将XML文档写出- Parameters:
file- 目标
-
write
将XML文档写出- Parameters:
writer- 目标
-
write
将XML文档写出- Parameters:
out- 目标
-
write
将XML文档写出 格式化输出逻辑参考:https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java- Parameters:
result- 目标
-