org.apache.ws.commons.serialize

Class XMLWriterImpl

Implemented Interfaces:
org.xml.sax.ContentHandler, XMLWriter
Known Direct Subclasses:
CharSetXMLWriter, OrderedAttributeXMLWriter, PassThroughXMLWriter

public class XMLWriterImpl
extends java.lang.Object
implements XMLWriter

Default implementation of XMLWriter. Works with Java 1.2 and later.

Method Summary

boolean
canEncode(char c)
void
characters(char[] ch, int start, int length)
Inserts a string of characters into the document.
void
endDocument()
This method finishs the handlers action.
void
endElement(String namespaceURI, String localName, String qName)
Terminates an element.
void
endPrefixMapping(String prefix)
Terminates use of a namespace prefix.
Locator
getDocumentLocator()
Returns the locator
String
getEncoding()
String
getIndentString()
String
getLineFeed()
Writer
getWriter()
Returns the JaxbXMLSerializers Writer.
void
ignorableWhitespace(char[] ch, int start, int length)
Calls the character method with the same arguments.
boolean
isDeclarating()
boolean
isFlushing()
boolean
isIndenting()
void
processingInstruction(String target, String data)
Inserts a processing instruction.
void
setDeclarating(boolean pDeclarating)
void
setDocumentLocator(Locator pLocator)
Sets the locator.
void
setEncoding(String pEncoding)
void
setFlushing(boolean pFlushing)
void
setIndentString(String pIndentString)
void
setIndenting(boolean pIndenting)
void
setLineFeed(String pLineFeed)
void
setWriter(Writer pWriter)
Sets the JaxbXMLSerializers Writer.
void
skippedEntity(String ent)
Not actually implemented, because I don't know how to skip entities.
void
startDocument()
Starts a document.
void
startElement(String namespaceURI, String localName, String qName, Attributes attr)
Starts a new element.
void
startPrefixMapping(String prefix, String namespaceURI)
Starts use of a namespace prefix.

Method Details

canEncode

public boolean canEncode(char c)
Specified by:
canEncode in interface XMLWriter

characters

public void characters(char[] ch,
                       int start,
                       int length)
            throws SAXException
Inserts a string of characters into the document.
Parameters:
ch - The characters being inserted. A substring, to be precise.
start - Index of the first character
length - Number of characters being inserted

endDocument

public void endDocument()
            throws SAXException
This method finishs the handlers action. After calling endDocument you may start a new action by calling startDocument again.

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
            throws SAXException
Terminates an element.
Parameters:
namespaceURI - The namespace URI, if any, or null
localName - The local name, without prefix, or null
qName - The qualified name, including a prefix, or null

endPrefixMapping

public void endPrefixMapping(String prefix)
            throws SAXException
Terminates use of a namespace prefix.
Parameters:
prefix - The prefix being abandoned.

getDocumentLocator

public Locator getDocumentLocator()
Returns the locator
Returns:
A locator previously set with setDocumentLocator or null.

getEncoding

public String getEncoding()
Specified by:
getEncoding in interface XMLWriter

getIndentString

public String getIndentString()
Specified by:
getIndentString in interface XMLWriter

getLineFeed

public String getLineFeed()
Specified by:
getLineFeed in interface XMLWriter

getWriter

public Writer getWriter()
Returns the JaxbXMLSerializers Writer.
Specified by:
getWriter in interface XMLWriter

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
            throws SAXException
Calls the character method with the same arguments.
Parameters:
ch - A string of whitespace characters being inserted into the document.
start - The index of the first character.
length - The number of characters.

isDeclarating

public boolean isDeclarating()
Specified by:
isDeclarating in interface XMLWriter

isFlushing

public boolean isFlushing()
Specified by:
isFlushing in interface XMLWriter

isIndenting

public boolean isIndenting()
Specified by:
isIndenting in interface XMLWriter

processingInstruction

public void processingInstruction(String target,
                                  String data)
            throws SAXException
Inserts a processing instruction.
Parameters:
target - The PI target
data - The PI data

setDeclarating

public void setDeclarating(boolean pDeclarating)
Specified by:
setDeclarating in interface XMLWriter

setDocumentLocator

public void setDocumentLocator(Locator pLocator)
Sets the locator.
Parameters:
pLocator - A locator for use in case of errors

setEncoding

public void setEncoding(String pEncoding)
Specified by:
setEncoding in interface XMLWriter

setFlushing

public void setFlushing(boolean pFlushing)
Specified by:
setFlushing in interface XMLWriter

setIndentString

public void setIndentString(String pIndentString)
Specified by:
setIndentString in interface XMLWriter

setIndenting

public void setIndenting(boolean pIndenting)
Specified by:
setIndenting in interface XMLWriter

setLineFeed

public void setLineFeed(String pLineFeed)
Specified by:
setLineFeed in interface XMLWriter

setWriter

public void setWriter(Writer pWriter)
Sets the JaxbXMLSerializers Writer.
Specified by:
setWriter in interface XMLWriter

skippedEntity

public void skippedEntity(String ent)
            throws SAXException
Not actually implemented, because I don't know how to skip entities.
Parameters:
ent - The entity being skipped.

startDocument

public void startDocument()
            throws SAXException
Starts a document.

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes attr)
            throws SAXException
Starts a new element.
Parameters:
namespaceURI - The namespace URI, if any, or null
localName - The local name, without prefix, or null
qName - The qualified name, including a prefix, or null
attr - The element attributes

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String namespaceURI)
            throws SAXException
Starts use of a namespace prefix.
Parameters:
prefix - The prefix
namespaceURI - The namespace URI