Class XMLOutputStream

public class XMLOutputStream extends >OutputStream
{
  // Constructors
  public XMLOutputStream( OutputStream out);

  // Methods
  public void close() throws IOException;
  public void flush() throws IOException;
  public void setEncoding( String encoding, boolean littleendian,
        boolean byteOrderMark ) throws IOException;
  public void write( int c ) throws IOException;
  public void writeChars( String str ) throws IOException;
  public void writeQualifiedName(Name n, Atom ns)
        throws IOException;
  public void writeQuotedString( String str ) throws IOException;
}

A writer specifically designed for dealing with XML, incluing XML encoding as well as liitleendian files, and XML namespaces and white space handling.

>OutputStream
  |
  +--XMLOutputStream

Constructors

XMLOutputStream

public XMLOutputStream( OutputStream out);

Builds the XMLOutputStream. It is created as a standard UTF-8 output stream. A subsequent call to setEncoding will specify the correct character encoding required. XMLOutputStreams can be built by using the createOutputStream method contained in XMLInputStream.

Methods

close 

public void close() throws IOException;

Pass-through of inherited OutputStream method.

flush 

public void flush() throws IOException;

Pass-through of inherited OutputStream method.

setEncoding 

public void setEncoding( String encoding, boolean littleendian,
        boolean byteOrderMark ) throws IOException;

Defines the character encoding of the output stream.

write 

public void write( int c ) throws IOException;

writes a character to the stream according to the current writeState. There is an extra state for a UCS-2 requiring a ByteOrderMark so as to avoid an extra conditional in every UCS2 write. The ByteOrderMark will only be written once at the beginning of the file.

writeChars 

public void writeChars( String str ) throws IOException;

Write the given string.

writeQualifiedName 

public void writeQualifiedName(Name n, Atom ns)
        throws IOException;

This method writes out the fully qualified name, using the appropriate short name syntax. For example: "foo:bar".

ParameterDescription
nthe name being written
nsthe name space which defines the context in which the name was defined.

writeQuotedString 

public void writeQuotedString( String str ) throws IOException;

Write out the string with quotes around it. This method uses the quotes that are appropriate for the string. I.E. if the string contains a ' then it uses ", & vice versa.