org.apache.ws.jaxme.impl

Class XMLWriterImpl

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

public class XMLWriterImpl
extends java.lang.Object
implements XMLWriter

A simple serializer for XML documents.
Author:
Jochen Wiedmann

Constructor Summary

XMLWriterImpl()
Creates a new JaxbXmlSerializer

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
JMMarshallerImpl
getMarshaller()
Returns the JaxbXMLSerializers Marshaller.
Writer
getWriter()
Returns the JaxbXMLSerializers Writer.
void
ignorableWhitespace(char[] ch, int start, int length)
Calls the character method with the same arguments.
void
init(JMMarshallerImpl pMarshaller)
Sets the JaxbXMLSerializers Marshaller.
void
processingInstruction(String target, String data)
Inserts a processing instruction.
void
setDocumentLocator(Locator pLocator)
Sets the locator.
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.

Constructor Details

XMLWriterImpl

public XMLWriterImpl()
Creates a new JaxbXmlSerializer

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.

getMarshaller

public JMMarshallerImpl getMarshaller()
Returns the JaxbXMLSerializers Marshaller.

getWriter

public Writer getWriter()
Returns the JaxbXMLSerializers Writer.

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.

init

public void init(JMMarshallerImpl pMarshaller)
            throws JAXBException
Sets the JaxbXMLSerializers Marshaller.
Specified by:
init 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

setDocumentLocator

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

setWriter

public void setWriter(Writer pWriter)
            throws JAXBException
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