# XML:Builder:Namespaces

### Import List

        URI
        XML:Builder
        XML:DTD
        XML:Locator

Class List
Builder |

Class Summary: Builder [Detail]

      +---XML:Builder.Builder
           |
           +--XML:Builder:Namespaces.Builder

Constructor Summary
Init(Builder, Builder)
New(Builder): Builder Creates a new builder that performs namespaces transformations on the parser callbacks.
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.
Comment(VAR StringVar, CharPos, CharPos) Called for comments.
EndCDATA() Called at the end of a CDATA section.
EndDTD(ExternalEntity, BOOLEAN) This method is called by the paser when is done parsing the document type declaration.
EndDocument() Called by the parser after it has processed the whole document.
EndElement(NamespaceDeclaration, String) Called when an end tag is parsed.
EndEntity(Entity) Called when parsing of the replacement text of entity is done.
EntityDecl(Entity) Called for declarations of general entities.
NamespaceDeclaration(NamespaceDeclaration) Called for namespace declarations in an attribute list.
Notation(Notation) Called for notation declarations.
ProcessingInstruction(String, VAR StringVar, CharPos, CharPos, URI) Called for processing instructions.
SetErrorListener(ErrorListener) Indicates the object el that the builder should use for error signalling.
SetLocator(Locator) Indicates which locator object the parser uses to communicate positional information.
SkippedEntity(String, Entity) This method is called for every entity skipped by a non-validating parser, if it configured to ignore references to external parsed entities.
StartCDATA() Called at the beginning of a CDATA section.
StartDTD(Builder) Called by the parser just before it begins parsing the document type declaration.
StartDocument(ExternalEntity) Marks the start of the document.
StartElement(NamespaceDeclaration, String) Called whenever a start tag is being parsed.
StartEntity(Entity) This method is called before the replacement text of a general entity is inspected in an element's content.
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

Type Summary
[ElementData] = RECORD ... END
[NamespaceList] = POINTER TO ARRAY OF NamespaceDeclaration
[Stack] = POINTER TO ARRAY OF ElementData

Class Detail: Builder

Constructor Detail

### Init

    PROCEDURE Init(b: Builder;
                   delegateBuilder: Builder)

### New

    PROCEDURE New(delegateBuilder: Builder): Builder

> Creates a new builder that performs namespaces transformations on the parser callbacks. Except for splitting qualified names into namespace URI and local name, all callbacks are passed on to delegateBuilder unchanged.

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

### Comment

    PROCEDURE (b: Builder) Comment(VAR chars: StringVar;
                      start: CharPos;
                      end: CharPos)

> Called for comments. The array slice ``chars[start, end[`' holds the comment's content.

> The locator is positioned at the ``<!--`'.

> [Description inherited from Comment]

> Redefines: Comment

### EndCDATA

    PROCEDURE (b: Builder) EndCDATA()

> Called at the end of a CDATA section. The locator refers to the position after the ``]]>`'.

> [Description inherited from EndCDATA]

> Redefines: EndCDATA

### EndDTD

    PROCEDURE (b: Builder) EndDTD(externalDTD: ExternalEntity;
                     allDeclarationsProcessed: BOOLEAN)

> This method is called by the paser when is done parsing the document type declaration. If the DTD had an external subset, the reference to the entity is passed in externalDTD. The public and system identifier of the external subset are available through the entity item.

> If allDeclarationsProcessed is TRUE, then the parser has read the complete DTD.

> The locator is positioned after the closing ``>`' of the DTD, and the external DTD subset has been processed.

> [Description inherited from EndDTD]

> Redefines: EndDTD

### 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

### EndEntity

    PROCEDURE (b: Builder) EndEntity(entity: Entity)

> Called when parsing of the replacement text of entity is done. The locator points to the first character after the entity reference.

> [Description inherited from EndEntity]

> Redefines: EndEntity

### EntityDecl

    PROCEDURE (b: Builder) EntityDecl(entity: Entity)

> Called for declarations of general entities. The locator points to the first character of the declared name.

> Note: The document entity is passed to Builder.StartDocument, and the entity for the external DTD subset to Builder.EndDTD, of it exists.

> [Description inherited from EntityDecl]

> Redefines: EntityDecl

### NamespaceDeclaration

    PROCEDURE (b: Builder) NamespaceDeclaration(namespaceDecl: NamespaceDeclaration)

> Called for namespace declarations in an attribute list. Note: The parser implementation XML:Parser.Parser does not know about namespaces and never calls this method. Use the adapter builder XML:Builder:Namespaces.Builder to introduce namespace information into the event stream. The locator position is undefined.

> [Description inherited from NamespaceDeclaration]

> Redefines: NamespaceDeclaration

### Notation

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

> Called for notation declarations. The locator points to the first character of the declared name.

> [Description inherited from Notation]

> 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

### SetErrorListener

    PROCEDURE (b: Builder) SetErrorListener(el: ErrorListener)

> Indicates the object el that the builder should use for error signalling. Any errors will subsequently be reported through el.Error. This method is called by the parser before it begins processing of the document.

> [Description inherited from SetErrorListener]

> Redefines: SetErrorListener

### SetLocator

    PROCEDURE (b: Builder) SetLocator(locator: Locator)

> Indicates which locator object the parser uses to communicate positional information. If this method is not called before Builder.StartDocument, the builder should assume that no locator is available during processing. This method may be called several times during processing of a document.

> Pre-condition: ``locator`' is not NIL.

> [Description inherited from SetLocator]

> Redefines: SetLocator

### SkippedEntity

    PROCEDURE (b: Builder) SkippedEntity(name: String;
                            referent: Entity)

> This method is called for every entity skipped by a non-validating parser, if it configured to ignore references to external parsed entities. name is the name of the skipped entity and referent its entity declaration, if this information is available. The locator refers to the beginning of the name of the entity reference.

> [Description inherited from SkippedEntity]

> Redefines: SkippedEntity

### StartCDATA

    PROCEDURE (b: Builder) StartCDATA()

> Called at the beginning of a CDATA section. The next calls to Builder.Characters before Builder.EndCDATA represent the CDATA's character content.

> The locator is positioned at ``<![CDATA[`'.

> [Description inherited from StartCDATA]

> Redefines: StartCDATA

### StartDTD

    PROCEDURE (b: Builder) StartDTD(dtdBuilder: Builder)

> Called by the parser just before it begins parsing the document type declaration. dtdBuilder is the object that is used by the parser to build the DTD data structure. All comments and processing instruction events that are reported between Builder.StartDTD and Builder.EndDTD are part of the DTD. Events from the internal DTD are reported before events of the external DTD. The locator is positioned at the beginning of ``<!DOCTYPE`'.

> [Description inherited from StartDTD]

> Redefines: StartDTD

### 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

### StartEntity

    PROCEDURE (b: Builder) StartEntity(entity: Entity)

> This method is called before the replacement text of a general entity is inspected in an element's content. entity refers to the entity that is being expanded. The locator points to the ``&`' in front of the name of the entity reference.

> [Description inherited from StartEntity]

> Redefines: StartEntity

Type Detail

### ElementData

    TYPE [ElementData] = RECORD
                       END

### NamespaceList

    TYPE [NamespaceList] = POINTER TO ARRAY OF NamespaceDeclaration

### Stack

    TYPE [Stack] = POINTER TO ARRAY OF ElementData