Module Interface XML:Builder:Canonical

SUMMARY: MODULE | CLASS | TYPE | PROC | VAR | CONST | DETAIL: TYPE | PROC | VAR | CONST

# XML:Builder:Canonical

### Import List

        IO
        URI
        XML:Builder
        XML:DTD
        XML:UnicodeBuffer
        XML:UnicodeCodec

Class List
Builder |
Node |

Class Summary: Builder [Detail]
      +---XML:Builder.Builder
           |
           +--XML:Builder:Canonical.Builder
Field Summary
out-: Output
Constructor Summary
New(ByteChannel, Factory, SHORTINT): Builder Creates a new writer.
Method Summary
Attribute(NamespaceDeclaration, String, AttrDecl, AttValue, BOOLEAN) Called for every attribute (specified or defaulted) of the current element.
AttributesDone() Called when the all attributes of a start tag, specified or defaulted, have been reported to the application.
Characters(VAR StringVar, CharPos, CharPos, ElementWhitespaceType) Called for non-markup characters that appear within the document element.
EndDocument() Called by the parser after it has processed the whole document.
EndElement(NamespaceDeclaration, String) Called when an end tag is parsed.
Notation(Notation) Called for notation declarations, see 2.10.
ProcessingInstruction(String, VAR StringVar, CharPos, CharPos, URI) Called for processing instructions.
StartDocument(ExternalEntity) Marks the start of the document.
StartElement(NamespaceDeclaration, String) Called whenever a start tag is being parsed.
Inherited Methods
From XML:Builder.Builder: Attribute, AttributesDone, Characters, Comment, EndCDATA, EndDTD, EndDocument, EndElement, EndEntity, EntityDecl, NamespaceDeclaration, Notation, ProcessingInstruction, SetErrorListener, SetLocator, SkippedEntity, StartCDATA, StartDTD, StartDocument, StartElement, StartEntity

Class Summary: Node [Detail]
      +--XML:Builder:Canonical.Node

Type Summary
[Attribute] = RECORD ... END
[AttributeList] = POINTER TO ARRAY OF Attribute

Constant Summary
firstCanonicalForm
secondCanonicalForm
thirdCanonicalForm

Class Detail: Builder

Field Detail

### out

    FIELD out-: Output

Constructor Detail

### New

    PROCEDURE New(outputChannel: ByteChannel;
                  codecFactory: Factory;
                  format: SHORTINT): Builder

> Creates a new writer. The output is directory to outputChannel, using the encoding specified with codecFactory. format selects between the different canonical forms.

Method Detail

### Attribute

    PROCEDURE (b: Builder) Attribute(namespaceDecl: NamespaceDeclaration;
                        localName: String;
                        attrDecl: AttrDecl;
                        value: AttValue;
                        specified: BOOLEAN)

> Called for every attribute (specified or defaulted) of the current element. For a namespace aware parser, namespaceDecl refers to the namespace URI of the element name. If the name has no namespace part, the argument is NIL. localName is the element minus the namespace prefix and the colon. The namespace prefix of the attribute name can be obtained from namespaceDecl.

> If an attribute declaration for this attribute is known to the parser, it is passed in attrDecl. Without a declaration, the application should treat the attribute as if it were of type DTD.attrCDATA.

> If the attribute is specified in the element's attribute list, instead of being defaulted from the attribute's declaration, specified is TRUE.

> The attribute's value is passed into the parameter value. Call DTD.AttValue.Flatten or DTD.AttValue.FlattenValue to retrieve the normalized value of the attribute. You can also access the data structure value. The string values in the data structure are normalized for CDATA values. When reading value for non-CDATA attributes, you must collapse sequences of whitespace into a single space, and remove any whitespace from the beginning and the end of the attribute value.

> The locator is at the beginning of the attribute's name, if specified is TRUE. For defaulted attributes, the locator is undefined.

> [Description inherited from Attribute]

> Redefines: Attribute

### AttributesDone

    PROCEDURE (b: Builder) AttributesDone()

> Called when the all attributes of a start tag, specified or defaulted, have been reported to the application. The locator is positioned after the closing ``>`' of the start or empty element tag.

> [Description inherited from AttributesDone]

> Redefines: AttributesDone

### Characters

    PROCEDURE (b: Builder) Characters(VAR chars: StringVar;
                         charsStart: CharPos;
                         charsEnd: CharPos;
                         elementWhitespace: ElementWhitespaceType)

> Called for non-markup characters that appear within the document element. The array slice ``chars[charsStart, charsEnd[`' holds the character data. elementWhitespace indicates whether the characters are whitespace appearing within element content.

> The locator refers to the first character.

> Note: It is up to the parser how it partitions character data before reporting it to the application. For example, the character data of an element may be reported in one call to Builder.Characters, or in multiple chunks, depending on embedded character references, general entity references, CDATA sections, and the size of the character content. It is only guaranteed that this procedure is called with an integral number of ISO 10646 characters (e.g., surrogate pairs are reported in one call).

> [Description inherited from Characters]

> Redefines: Characters

### EndDocument

    PROCEDURE (b: Builder) EndDocument()

> Called by the parser after it has processed the whole document. Afterwards, none of the other builder methods will be called. Note that unlike all the other event reporting methods, this method is even called if the document had a fatal error. The locator is positioned at the very end of the file.

> [Description inherited from EndDocument]

> Redefines: EndDocument

### EndElement

    PROCEDURE (b: Builder) EndElement(namespaceDecl: NamespaceDeclaration;
                         localName: String)

> Called when an end tag is parsed. See Builder.StartElement for a description of the arguments. The locator is positioned at the beginning of the end tag's name, if an explicit end tag exists. Otherwise, it is placed after the closing ``/>`' of the empty element tag.

> [Description inherited from EndElement]

> Redefines: EndElement

### Notation

    PROCEDURE (b: Builder) Notation(notation: Notation)

> Called for notation declarations, see 2.10.

> Redefines: Notation

### ProcessingInstruction

    PROCEDURE (b: Builder) ProcessingInstruction(target: String;
                                    VAR content: StringVar;
                                    contentStart: CharPos;
                                    contentEnd: CharPos;
                                    baseURI: URI)

> Called for processing instructions. target holds the PI's target part. The array slice ``content[contentStart, contentEnd[`' holds the content data. baseURI is the absolute URI of the entity in which the PI appears.

> The locator is positioned at the ``<?`'.

> [Description inherited from ProcessingInstruction]

> Redefines: ProcessingInstruction

### StartDocument

    PROCEDURE (b: Builder) StartDocument(documentEntity: ExternalEntity)

> Marks the start of the document. This method is called just before parsing begins. The base URI of the document can be obtained from documentEntity, if it has been passed to XML:Parser.NewChannel. The locator is positioned at the very beginning of the file.

> [Description inherited from StartDocument]

> Redefines: StartDocument

### StartElement

    PROCEDURE (b: Builder) StartElement(namespaceDecl: NamespaceDeclaration;
                           localName: String)

> Called whenever a start tag is being parsed. For a namespace aware parser, namespaceDecl refers to the namespace URI of the element name. If the name has no namespace part, the argument is NIL. localName is the element minus the namespace prefix and the colon. The namespace prefix of the attribute name can be obtained from namespaceDecl.

> b The locator is positioned at the beginning of the start tag's name.

> Note: Namespaces are only partially supported in the parser itself. For full namespace support, the special builder class XML:Builder:Namespaces.Builder must be put between the parser and the application.

> [Description inherited from StartElement]

> Redefines: StartElement

Class Detail: Node

Type Detail

### Attribute

    TYPE [Attribute] = RECORD
                     END

### AttributeList

    TYPE [AttributeList] = POINTER TO ARRAY OF Attribute

Constant Detail

### firstCanonicalForm

    CONST firstCanonicalForm

### secondCanonicalForm

    CONST secondCanonicalForm

### thirdCanonicalForm

    CONST thirdCanonicalForm