de.fu_berlin.ties.xml
Class TagIsolator

java.lang.Object
  extended by de.fu_berlin.ties.xml.TagIsolator

public class TagIsolator
extends Object

"Isolates" XML tags and textual contents in an XML/HTML document by printing each XML/HTML tag on a single line. This class is thread-safe.

Version:
$Revision: 1.1 $, $Date: 2004/02/02 18:50:16 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String LINE_SEPARATOR_CLASS
          The character class of line separators.
static String SINGLE_LINE_WHITESPACE
          The class of whitespace characters that are not line separators.
 
Constructor Summary
TagIsolator()
          Creates a new instance.
 
Method Summary
 void isolateTags(Reader reader, Writer writer)
          "Isolates" XML tags and textual contents in an XML document by printing each XML tag on a single line.
 void isolateTags(Reader reader, Writer writer, Map replacements)
          "Isolates" XML tags and textual contents in an XML document by printing each XML tag on a single line.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LINE_SEPARATOR_CLASS

public static final String LINE_SEPARATOR_CLASS
The character class of line separators.

See Also:
Constant Field Values

SINGLE_LINE_WHITESPACE

public static final String SINGLE_LINE_WHITESPACE
The class of whitespace characters that are not line separators.

See Also:
Constant Field Values
Constructor Detail

TagIsolator

public TagIsolator()
Creates a new instance.

Method Detail

isolateTags

public final void isolateTags(Reader reader,
                              Writer writer)
                       throws IOException
"Isolates" XML tags and textual contents in an XML document by printing each XML tag on a single line. This might introduce additional whitespace, so it should be used with care in situations where whitespace is significant. Neither reader nor writer are closed by this method.

Parameters:
reader - the reader to read the original XML file from
writer - the writer to write the modified XML file to
Throws:
IOException - if an I/O error occurs while reading or writing the data

isolateTags

public final void isolateTags(Reader reader,
                              Writer writer,
                              Map replacements)
                       throws IOException
"Isolates" XML tags and textual contents in an XML document by printing each XML tag on a single line. This might introduce additional whitespace, so it should be used with care in situations where whitespace is significant. Neither reader nor writer are closed by this method.

Parameters:
reader - the reader to read the original XML file from
writer - the writer to write the modified XML file to
replacements - a map of additional replacements to perform within the XML tags; maps regular expression Patterns to replacement Strings; might be null
Throws:
IOException - if an I/O error occurs while reading or writing the data

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
a textual representation


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.