net.sf.jaxme.impl
Class XMLWriterImpl

java.lang.Object
  extended bynet.sf.jaxme.impl.XMLWriterImpl
All Implemented Interfaces:
ContentHandler, XMLWriter
Direct Known Subclasses:
CharSetXMLWriter, 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
protected  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(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Terminates an element.
 void endPrefixMapping(java.lang.String prefix)
          Terminates use of a namespace prefix.
 Locator getDocumentLocator()
          Returns the locator
 JMMarshallerImpl getMarshaller()
          Returns the JaxbXMLSerializers Marshaller.
 java.io.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(java.lang.String target, java.lang.String data)
          Inserts a processing instruction.
 void setDocumentLocator(Locator pLocator)
          Sets the locator.
 void setWriter(java.io.Writer pWriter)
          Sets the JaxbXMLSerializers Writer.
 void skippedEntity(java.lang.String ent)
          Not actually implemented, because I don't know how to skip entities.
 void startDocument()
          Starts a document.
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes attr)
          Starts a new element.
 void startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI)
          Starts use of a namespace prefix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriterImpl

public XMLWriterImpl()
Creates a new JaxbXmlSerializer

Method Detail

init

public void init(JMMarshallerImpl pMarshaller)
          throws JAXBException

Sets the JaxbXMLSerializers Marshaller.

Specified by:
init in interface XMLWriter
Throws:
JAXBException

getMarshaller

public JMMarshallerImpl getMarshaller()

Returns the JaxbXMLSerializers Marshaller.


setWriter

public void setWriter(java.io.Writer pWriter)
               throws JAXBException

Sets the JaxbXMLSerializers Writer.

Specified by:
setWriter in interface XMLWriter
Throws:
JAXBException

getWriter

public java.io.Writer getWriter()

Returns the JaxbXMLSerializers Writer.


setDocumentLocator

public void setDocumentLocator(Locator pLocator)
Sets the locator.

Specified by:
setDocumentLocator in interface ContentHandler
Parameters:
pLocator - A locator for use in case of errors
See Also:
getDocumentLocator()

getDocumentLocator

public Locator getDocumentLocator()
Returns the locator

Returns:
A locator previously set with setDocumentLocator or null.
See Also:
setDocumentLocator(org.xml.sax.Locator)

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String namespaceURI)
                        throws SAXException

Starts use of a namespace prefix.

Specified by:
startPrefixMapping in interface ContentHandler
Parameters:
namespaceURI - The namespace URI
prefix - The prefix
Throws:
SAXException - Not actually thrown, just for compliance to the interface specification.

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws SAXException

Terminates use of a namespace prefix.

Specified by:
endPrefixMapping in interface ContentHandler
Parameters:
prefix - The prefix being abandoned.
Throws:
SAXException - Not actually thrown, just for compliance to the interface specification.

startDocument

public void startDocument()
                   throws SAXException

Starts a document.

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException - Not actually thrown, just for compliance to the interface specification.

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.

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException - Not actually thrown, just for compliance to the interface specification.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Calls the character method with the same arguments.

Specified by:
ignorableWhitespace in interface ContentHandler
Parameters:
ch - A string of whitespace characters being inserted into the document.
start - The index of the first character.
length - The number of characters.
Throws:
SAXException - Thrown in case of an IOException.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Inserts a string of characters into the document.

Specified by:
characters in interface ContentHandler
Parameters:
ch - The characters being inserted. A substring, to be precise.
start - Index of the first character
length - Number of characters being inserted
Throws:
SAXException - Thrown in case of an IOException

canEncode

protected boolean canEncode(char c)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws SAXException

Terminates an element.

Specified by:
endElement in interface ContentHandler
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
Throws:
SAXException - Thrown in case of an IOException.

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         Attributes attr)
                  throws SAXException
Starts a new element.

Specified by:
startElement in interface ContentHandler
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
Throws:
SAXException - Thrown in case of an IOException.

skippedEntity

public void skippedEntity(java.lang.String ent)
                   throws SAXException
Not actually implemented, because I don't know how to skip entities.

Specified by:
skippedEntity in interface ContentHandler
Parameters:
ent - The entity being skipped.
Throws:
SAXException - Not actually thrown, just for compliance to the interface specification.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws SAXException
Inserts a processing instruction.

Specified by:
processingInstruction in interface ContentHandler
Parameters:
target - The PI target
data - The PI data
Throws:
SAXException - Thrown in case of an IOException