org.apache.maven.shared.utils.xml
Class PrettyPrintXMLWriter

java.lang.Object
  extended by org.apache.maven.shared.utils.xml.PrettyPrintXMLWriter
All Implemented Interfaces:
XMLWriter

public class PrettyPrintXMLWriter
extends Object
implements XMLWriter

XMLWriter with nice indentation


Constructor Summary
PrettyPrintXMLWriter(PrintWriter writer)
           
PrettyPrintXMLWriter(PrintWriter writer, String lineIndent)
           
PrettyPrintXMLWriter(PrintWriter writer, String encoding, String doctype)
           
PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String encoding, String doctype)
           
PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String lineSeparator, String encoding, String doctype)
           
PrettyPrintXMLWriter(Writer writer)
           
PrettyPrintXMLWriter(Writer writer, String lineIndent)
           
PrettyPrintXMLWriter(Writer writer, String encoding, String doctype)
           
PrettyPrintXMLWriter(Writer writer, String lineIndent, String encoding, String doctype)
           
 
Method Summary
 void addAttribute(String key, String value)
          Add a XML attribute to the current XML Element.
 void endElement()
          End the previously opened element.
 void setDocType(String docType)
          Sets the docType of the document.
 void setEncoding(String encoding)
          Sets the encoding of the document.
 void setLineIndenter(String lineIndent)
           
 void setLineSeparator(String lineSeparator)
           
 void startElement(String elementName)
          Start an XML Element tag.
 void writeMarkup(String markup)
          Add a preformatted markup to the current element tag
 void writeText(String text)
          Add a value text to the current element tag This will perform XML escaping to guarantee valid content
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(PrintWriter writer,
                            String lineIndent)
Parameters:
writer - not null
lineIndent - could be null, but the normal way is some spaces.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(Writer writer,
                            String lineIndent)
Parameters:
writer - not null
lineIndent - could be null, but the normal way is some spaces.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(PrintWriter writer)
Parameters:
writer - not null

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(Writer writer)
Parameters:
writer - not null

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(PrintWriter writer,
                            String lineIndent,
                            String encoding,
                            String doctype)
Parameters:
writer - not null
lineIndent - could be null, but the normal way is some spaces.
encoding - could be null or invalid.
doctype - could be null.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(Writer writer,
                            String lineIndent,
                            String encoding,
                            String doctype)
Parameters:
writer - not null
lineIndent - could be null, but the normal way is some spaces.
encoding - could be null or invalid.
doctype - could be null.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(PrintWriter writer,
                            String encoding,
                            String doctype)
Parameters:
writer - not null
encoding - could be null or invalid.
doctype - could be null.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(Writer writer,
                            String encoding,
                            String doctype)
Parameters:
writer - not null
encoding - could be null or invalid.
doctype - could be null.

PrettyPrintXMLWriter

public PrettyPrintXMLWriter(PrintWriter writer,
                            String lineIndent,
                            String lineSeparator,
                            String encoding,
                            String doctype)
Parameters:
writer - not null
lineIndent - could be null, but the normal way is some spaces.
lineSeparator - could be null, but the normal way is valid line separator
encoding - could be null or the encoding to use.
doctype - could be null.
Method Detail

addAttribute

public void addAttribute(String key,
                         String value)
Description copied from interface: XMLWriter
Add a XML attribute to the current XML Element. This method must get called immediately after XMLWriter.startElement(String)

Specified by:
addAttribute in interface XMLWriter

setEncoding

public void setEncoding(String encoding)
Description copied from interface: XMLWriter
Sets the encoding of the document. If not set, UTF-8 is being used

Specified by:
setEncoding in interface XMLWriter
Parameters:
encoding - the encoding

setDocType

public void setDocType(String docType)
Description copied from interface: XMLWriter
Sets the docType of the document.

Specified by:
setDocType in interface XMLWriter
Parameters:
docType - the docType

setLineSeparator

public void setLineSeparator(String lineSeparator)

setLineIndenter

public void setLineIndenter(String lineIndent)

startElement

public void startElement(String elementName)
Description copied from interface: XMLWriter
Start an XML Element tag.

Specified by:
startElement in interface XMLWriter

writeText

public void writeText(String text)
Description copied from interface: XMLWriter
Add a value text to the current element tag This will perform XML escaping to guarantee valid content

Specified by:
writeText in interface XMLWriter

writeMarkup

public void writeMarkup(String markup)
Description copied from interface: XMLWriter
Add a preformatted markup to the current element tag

Specified by:
writeMarkup in interface XMLWriter

endElement

public void endElement()
Description copied from interface: XMLWriter
End the previously opened element.

Specified by:
endElement in interface XMLWriter
See Also:
XMLWriter.startElement(String)


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.