Package org.codehaus.plexus.util.xml
Class XmlUtil
- java.lang.Object
-
- org.codehaus.plexus.util.xml.XmlUtil
-
public class XmlUtil extends Object
Common XML utilities methods.- Since:
- 1.5.7
- Author:
- Vincent Siveton
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description XmlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
DEFAULT_INDENTATION_SIZE
public static final int DEFAULT_INDENTATION_SIZE
The default line indenter size i.e. 2.- See Also:
- Constant Field Values
-
DEFAULT_LINE_SEPARATOR
public static final String DEFAULT_LINE_SEPARATOR
The default line separator ("\n" on UNIX)
-
-
Method Detail
-
isXml
public static boolean isXml(File f)
Determines if a given File shall be handled as XML.- Parameters:
f
- not null file- Returns:
true
if the given file has XML content,false
otherwise.
-
prettyFormat
public static void prettyFormat(Reader reader, Writer writer) throws IOException
Pretty format the input reader. For instance, the following input:<div><b>content</b></div>
becomes<div> <b>content</b> </div>
- Parameters:
reader
- not nullwriter
- not null- Throws:
IOException
- if any or invalid xml content- See Also:
prettyFormat(Reader, Writer, int, String)
,to read an xml content
,to write an xml content
-
prettyFormat
public static void prettyFormat(Reader reader, Writer writer, int indentSize, String lineSeparator) throws IOException
Pretty format the input reader. For instance, the following input:<div><b>content</b></div>
becomes<div> <b>content</b> </div>
- Parameters:
reader
- not nullwriter
- not nullindentSize
- positive number for the indentationlineSeparator
- the wanted line separator- Throws:
IOException
- if any or invalid xml content- See Also:
to read an xml content
,to write an xml content
-
prettyFormat
public static void prettyFormat(InputStream is, OutputStream os) throws IOException
Pretty format the input stream. For instance, the following input:<div><b>content</b></div>
becomes<div> <b>content</b> </div>
- Parameters:
is
- not nullos
- not null- Throws:
IOException
- if any or invalid xml content- See Also:
prettyFormat(InputStream, OutputStream, int, String)
-
prettyFormat
public static void prettyFormat(InputStream is, OutputStream os, int indentSize, String lineSeparator) throws IOException
Pretty format the input stream. For instance, the following input:<div><b>content</b></div>
becomes<div> <b>content</b> </div>
- Parameters:
is
- not nullos
- not nullindentSize
- positive number for the indentationlineSeparator
- the wanted line separator- Throws:
IOException
- if any or invalid xml content
-
-