public class XmlUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INDENTATION_SIZE
The default line indenter size i.e.
|
static java.lang.String |
DEFAULT_LINE_SEPARATOR
The default line separator ("\n" on UNIX)
|
| Constructor and Description |
|---|
XmlUtil() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isXml(java.io.File f)
Determines if a given File shall be handled as XML.
|
static void |
prettyFormat(java.io.InputStream is,
java.io.OutputStream os)
Pretty format the input stream.
|
static void |
prettyFormat(java.io.InputStream is,
java.io.OutputStream os,
int indentSize,
java.lang.String lineSeparator)
Pretty format the input stream.
|
static void |
prettyFormat(java.io.Reader reader,
java.io.Writer writer)
Pretty format the input reader.
|
static void |
prettyFormat(java.io.Reader reader,
java.io.Writer writer,
int indentSize,
java.lang.String lineSeparator)
Pretty format the input reader.
|
private static void |
prettyFormatInternal(XmlPullParser parser,
PrettyPrintXMLWriter writer) |
public static final int DEFAULT_INDENTATION_SIZE
public static final java.lang.String DEFAULT_LINE_SEPARATOR
public static boolean isXml(java.io.File f)
f - not null filetrue if the given file has XML content, false otherwise.public static void prettyFormat(java.io.Reader reader,
java.io.Writer writer)
throws java.io.IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
reader - not nullwriter - not nulljava.io.IOException - if any or invalid xml contentprettyFormat(Reader, Writer, int, String),
to read an xml content,
to write an xml contentpublic static void prettyFormat(java.io.Reader reader,
java.io.Writer writer,
int indentSize,
java.lang.String lineSeparator)
throws java.io.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 separatorjava.io.IOException - if any or invalid xml contentto read an xml content,
to write an xml contentpublic static void prettyFormat(java.io.InputStream is,
java.io.OutputStream os)
throws java.io.IOException
<div><b>content</b></div>becomes
<div> <b>content</b> </div>
is - not nullos - not nulljava.io.IOException - if any or invalid xml contentprettyFormat(InputStream, OutputStream, int, String)public static void prettyFormat(java.io.InputStream is,
java.io.OutputStream os,
int indentSize,
java.lang.String lineSeparator)
throws java.io.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 separatorjava.io.IOException - if any or invalid xml contentprivate static void prettyFormatInternal(XmlPullParser parser, PrettyPrintXMLWriter writer) throws XmlPullParserException, java.io.IOException
parser - not nullwriter - not nullXmlPullParserException - if anyjava.io.IOException - if any