# XML:Writer

Planned changes for future releases:

- Rename Writer.AttrInt to ``AttrLInt`'.

- Rename ``*I`' methods to ``*Region`'.

- Provide methods for writing unquoted text (inherited methods from UnicodeBuffer.OutputDesc are not sufficient, because the writer holds state of start tag).

### Import List

        IO
        Object
        Object
        URI
        XML:UnicodeBuffer
        XML:UnicodeCodec

Class List
Writer | Note: Output is buffered.

Class Summary: Writer [Detail]

      +---XML:UnicodeBuffer.Output
           |
           +--XML:Writer.Writer

Note: Output is buffered. Calling Writer.EndOfText will also flush the buffers.

Field Summary
baseURI-: HierarchicalURI
Inherited Fields
From XML:UnicodeBuffer.Output: codec, codecFactory, error, writer
Constructor Summary
Init(Writer, ByteChannel, Factory, BOOLEAN, LONGINT)
New(ByteChannel, Factory, BOOLEAN, LONGINT): Writer
Method Summary
AttrBool(ARRAY OF Char, BOOLEAN)
AttrInt(ARRAY OF Char, LONGINT)
AttrObject(ARRAY OF Char, String)
AttrString(ARRAY OF Char, ARRAY OF Char)
AttrStringLatin1(ARRAY OF Char, ARRAY OF CHAR)
AttrURI(ARRAY OF Char, URI, BOOLEAN)
CloseStartTag()
EmptyTag(ARRAY OF Char)
EmptyTagLatin1(ARRAY OF Char)
EndOfText() Adds final newline to text and flushes all buffers.
EndTag()
NewLine()
SetBaseURI(HierarchicalURI)
SetEmptyElementHTML(BOOLEAN)
StartTag(ARRAY OF Char, BOOLEAN)
StartTagLatin1(ARRAY OF CHAR, BOOLEAN)
Write(ARRAY OF Char)
WriteI(ARRAY OF Char, LONGINT, LONGINT)
WriteLInt(LONGINT)
WriteLatin1(ARRAY OF CHAR)
WriteLatin1I(ARRAY OF CHAR, LONGINT, LONGINT)
WriteObject(Object)
WriteRealFix(REAL, LONGINT)
WriteTextDecl(ARRAY OF CHAR, ARRAY OF CHAR)
WriteURI(URI, BOOLEAN)
Inherited Methods
From XML:UnicodeBuffer.Output: Flush, Write16, Write16I, Write8, Write8I

Type Summary
Char = LONGCHAR
[Elements] = POINTER TO ARRAY OF RECORD ... END
[String] = POINTER TO ARRAY OF Char

Class Detail: Writer

Field Detail

### baseURI

    FIELD baseURI-: HierarchicalURI

Constructor Detail

### Init

    PROCEDURE Init(w: Writer;
                   writer: ByteChannel;
                   codecFactory: Factory;
                   writeBOM: BOOLEAN;
                   indentLevel: LONGINT)

### New

    PROCEDURE New(writer: ByteChannel;
                  codecFactory: Factory;
                  writeBOM: BOOLEAN;
                  indentLevel: LONGINT): Writer

Method Detail

### AttrBool

    PROCEDURE (w: Writer) AttrBool(name: ARRAY OF Char;
                       value: BOOLEAN)

### AttrInt

    PROCEDURE (w: Writer) AttrInt(name: ARRAY OF Char;
                      value: LONGINT)

### AttrObject

    PROCEDURE (w: Writer) AttrObject(name: ARRAY OF Char;
                         value: String)

### AttrString

    PROCEDURE (w: Writer) AttrString(name: ARRAY OF Char;
                         value: ARRAY OF Char)

### AttrStringLatin1

    PROCEDURE (w: Writer) AttrStringLatin1(name: ARRAY OF Char;
                               value: ARRAY OF CHAR)

### AttrURI

    PROCEDURE (w: Writer) AttrURI(name: ARRAY OF Char;
                      uri: URI;
                      absolute: BOOLEAN)

### CloseStartTag

    PROCEDURE (w: Writer) CloseStartTag()

### EmptyTag

    PROCEDURE (w: Writer) EmptyTag(name: ARRAY OF Char)

### EmptyTagLatin1

    PROCEDURE (w: Writer) EmptyTagLatin1(name: ARRAY OF Char)

### EndOfText

    PROCEDURE (w: Writer) EndOfText()
      RAISES Error;

> Adds final newline to text and flushes all buffers.

### EndTag

    PROCEDURE (w: Writer) EndTag()

### NewLine

    PROCEDURE (w: Writer) NewLine()

### SetBaseURI

    PROCEDURE (w: Writer) SetBaseURI(baseURI: HierarchicalURI)

### SetEmptyElementHTML

    PROCEDURE (w: Writer) SetEmptyElementHTML(html: BOOLEAN)

### StartTag

    PROCEDURE (w: Writer) StartTag(name: ARRAY OF Char;
                       mixedContent: BOOLEAN)

### StartTagLatin1

    PROCEDURE (w: Writer) StartTagLatin1(name: ARRAY OF CHAR;
                             mixedContent: BOOLEAN)

### Write

    PROCEDURE (w: Writer) Write(str: ARRAY OF Char)

### WriteI

    PROCEDURE (w: Writer) WriteI(str: ARRAY OF Char;
                     s: LONGINT;
                     e: LONGINT)

### WriteLInt

    PROCEDURE (w: Writer) WriteLInt(value: LONGINT)

### WriteLatin1

    PROCEDURE (w: Writer) WriteLatin1(str: ARRAY OF CHAR)

### WriteLatin1I

    PROCEDURE (w: Writer) WriteLatin1I(str: ARRAY OF CHAR;
                           s: LONGINT;
                           e: LONGINT)

### WriteObject

    PROCEDURE (w: Writer) WriteObject(obj: Object)

### WriteRealFix

    PROCEDURE (w: Writer) WriteRealFix(real: REAL;
                           k: LONGINT)

### WriteTextDecl

    PROCEDURE (w: Writer) WriteTextDecl(version: ARRAY OF CHAR;
                            standalone: ARRAY OF CHAR)

### WriteURI

    PROCEDURE (w: Writer) WriteURI(uri: URI;
                       absolute: BOOLEAN)

Type Detail

### Char

    TYPE Char = LONGCHAR

### Elements

    TYPE [Elements] = POINTER TO ARRAY OF RECORD
    YYYYEND

### String

    TYPE [String] = POINTER TO ARRAY OF Char