com.bea.xml.stream
Class XMLEventWriterBase

java.lang.Object
  extended by com.bea.xml.stream.XMLEventWriterBase
All Implemented Interfaces:
javax.xml.stream.util.XMLEventConsumer, javax.xml.stream.XMLEventWriter

public class XMLEventWriterBase
extends java.lang.Object
implements javax.xml.stream.XMLEventWriter, javax.xml.stream.util.XMLEventConsumer

The base writer class


Constructor Summary
XMLEventWriterBase(javax.xml.stream.XMLStreamWriter writer)
           
 
Method Summary
 void add(javax.xml.stream.events.XMLEvent e)
          This method adds an event to the consumer.
 void add(javax.xml.stream.XMLEventReader stream)
          Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.
 void addAttribute(javax.xml.stream.events.Attribute a)
           
 void addCharacters(javax.xml.stream.events.Characters cd)
           
 void addComment(javax.xml.stream.events.Comment c)
           
 void addDTD(javax.xml.stream.events.DTD dtd)
           
 void addEndDocument(javax.xml.stream.events.EndDocument ed)
           
 void addEntityReference(javax.xml.stream.events.EntityReference er)
           
 void addNamespace(javax.xml.stream.events.Namespace ns)
           
 void addProcessingInstruction(javax.xml.stream.events.ProcessingInstruction pi)
           
 void addStartDocument(javax.xml.stream.events.StartDocument sd)
           
 void close()
          Frees any resources associated with this stream
 void flush()
          Writes any cached events to the underlying output mechanism
 javax.xml.namespace.NamespaceContext getNamespaceContext()
          Returns the current namespace context.
 java.lang.String getPrefix(java.lang.String uri)
          Gets the prefix the uri is bound to
static void main(java.lang.String[] args)
           
 void setDefaultNamespace(java.lang.String uri)
          Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.
 void setNamespaceContext(javax.xml.namespace.NamespaceContext context)
          Sets the current namespace context for prefix and uri bindings.
 void setPrefix(java.lang.String prefix, java.lang.String uri)
          Sets the prefix the uri is bound to.
 void writeNamespace(javax.xml.stream.events.Namespace n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLEventWriterBase

public XMLEventWriterBase(javax.xml.stream.XMLStreamWriter writer)
Method Detail

flush

public void flush()
           throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Writes any cached events to the underlying output mechanism

Specified by:
flush in interface javax.xml.stream.XMLEventWriter
Throws:
javax.xml.stream.XMLStreamException

close

public void close()
           throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Frees any resources associated with this stream

Specified by:
close in interface javax.xml.stream.XMLEventWriter
Throws:
javax.xml.stream.XMLStreamException

addCharacters

public void addCharacters(javax.xml.stream.events.Characters cd)
                   throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addEntityReference

public void addEntityReference(javax.xml.stream.events.EntityReference er)
                        throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addProcessingInstruction

public void addProcessingInstruction(javax.xml.stream.events.ProcessingInstruction pi)
                              throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addComment

public void addComment(javax.xml.stream.events.Comment c)
                throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addStartDocument

public void addStartDocument(javax.xml.stream.events.StartDocument sd)
                      throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addEndDocument

public void addEndDocument(javax.xml.stream.events.EndDocument ed)
                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addAttribute

public void addAttribute(javax.xml.stream.events.Attribute a)
                  throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

writeNamespace

public void writeNamespace(javax.xml.stream.events.Namespace n)
                    throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addNamespace

public void addNamespace(javax.xml.stream.events.Namespace ns)
                  throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

addDTD

public void addDTD(javax.xml.stream.events.DTD dtd)
            throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

add

public void add(javax.xml.stream.events.XMLEvent e)
         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.util.XMLEventConsumer
This method adds an event to the consumer. Calling this method invalidates the event parameter. The client application should discard all references to this event upon calling add. The behavior of an application that continues to use such references is undefined.

Specified by:
add in interface javax.xml.stream.util.XMLEventConsumer
Specified by:
add in interface javax.xml.stream.XMLEventWriter
Parameters:
e - the event to add, may not be null
Throws:
javax.xml.stream.XMLStreamException

add

public void add(javax.xml.stream.XMLEventReader stream)
         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.

Specified by:
add in interface javax.xml.stream.XMLEventWriter
Parameters:
stream - the event stream to add to the output
Throws:
javax.xml.stream.XMLStreamException

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
                           throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Gets the prefix the uri is bound to

Specified by:
getPrefix in interface javax.xml.stream.XMLEventWriter
Parameters:
uri - the uri to look up
Throws:
javax.xml.stream.XMLStreamException

setPrefix

public void setPrefix(java.lang.String prefix,
                      java.lang.String uri)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.

Specified by:
setPrefix in interface javax.xml.stream.XMLEventWriter
Parameters:
prefix - the prefix to bind to the uri
uri - the uri to bind to the prefix
Throws:
javax.xml.stream.XMLStreamException

setDefaultNamespace

public void setDefaultNamespace(java.lang.String uri)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.

Specified by:
setDefaultNamespace in interface javax.xml.stream.XMLEventWriter
Parameters:
uri - the uri to bind to the default namespace
Throws:
javax.xml.stream.XMLStreamException

setNamespaceContext

public void setNamespaceContext(javax.xml.namespace.NamespaceContext context)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: javax.xml.stream.XMLEventWriter
Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.

Specified by:
setNamespaceContext in interface javax.xml.stream.XMLEventWriter
Parameters:
context - the namespace context to use for this writer
Throws:
javax.xml.stream.XMLStreamException

getNamespaceContext

public javax.xml.namespace.NamespaceContext getNamespaceContext()
Description copied from interface: javax.xml.stream.XMLEventWriter
Returns the current namespace context.

Specified by:
getNamespaceContext in interface javax.xml.stream.XMLEventWriter
Returns:
the current namespace context

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception