public class XmlUtil extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INDENTATION_SIZE
The default line indenter size i.e.
|
static String |
DEFAULT_LINE_SEPARATOR
The default line separator ("\n" on UNIX)
|
Constructor and Description |
---|
XmlUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isXml(File f)
Determines if a given File shall be handled as XML.
|
static void |
prettyFormat(InputStream is,
OutputStream os)
Pretty format the input stream.
|
static void |
prettyFormat(InputStream is,
OutputStream os,
int indentSize,
String lineSeparator)
Pretty format the input stream.
|
static void |
prettyFormat(Reader reader,
Writer writer)
Pretty format the input reader.
|
static void |
prettyFormat(Reader reader,
Writer writer,
int indentSize,
String lineSeparator)
Pretty format the input reader.
|
public static final int DEFAULT_INDENTATION_SIZE
public static final String DEFAULT_LINE_SEPARATOR
public static boolean isXml(File f)
f
- not null filetrue
if the given file has XML content, false
otherwise.public static void prettyFormat(Reader reader, Writer writer) throws IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
reader
- not nullwriter
- not nullIOException
- if any or invalid xml contentprettyFormat(Reader, Writer, int, String)
,
to read an xml content
,
to write an xml content
public static void prettyFormat(Reader reader, Writer writer, int indentSize, String lineSeparator) throws IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
reader
- not nullwriter
- not nullindentSize
- positive number for the indentationlineSeparator
- the wanted line separatorIOException
- if any or invalid xml contentto read an xml content
,
to write an xml content
public static void prettyFormat(InputStream is, OutputStream os) throws IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
is
- not nullos
- not nullIOException
- if any or invalid xml contentprettyFormat(InputStream, OutputStream, int, String)
public static void prettyFormat(InputStream is, OutputStream os, int indentSize, String lineSeparator) throws IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
is
- not nullos
- not nullindentSize
- positive number for the indentationlineSeparator
- the wanted line separatorIOException
- if any or invalid xml contentCopyright © 2001–2022 The Apache Software Foundation. All rights reserved.