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

# XML:Parser

### Import List

        IO
        Msg
        URI
        XML:Builder
        XML:DTD
        XML:EntityResolver
        XML:Error
        XML:Locator
        XML:UnicodeBuffer
        XML:UnicodeCodec
        XML:UnicodeCodec:UTF8

Class List
ErrorListener |
Parser |

Class Summary: ErrorListener [Detail]
      +---XML:Locator.ErrorListener
           |
           +--XML:Parser.ErrorListener
Method Summary
Error(Context, Code, BOOLEAN, Position): Msg Adds a new error message to the parser error list.
Inherited Methods
From XML:Locator.ErrorListener: Error

Class Summary: Parser [Detail]
      +--XML:Parser.Parser
Field Summary
enforceQNames: BOOLEAN If TRUE, then the parser checks that element and attribute names also match the production ``QName`', and that entity names, PI targets, and notation names contain no colon.
errList-: List Holds all error messages related to the currently parsed XML document.
followExternalRef: BOOLEAN If TRUE, then the parser should try to follow external references (references to the external DTD subset or to an external parameter entity).
validating: BOOLEAN If TRUE, then the parser checks that
Constructor Summary
NewChannel(ByteChannel, URI, Factory, Resolver, Builder): Parser Creates a new parser for the input channel ch.
NewExternalID(ARRAY OF Char, ARRAY OF Char, URI, Factory, Resolver, Builder, VAR Msg): Parser Like NewURI, using the given public or system identifier.
NewFile(ARRAY OF CHAR, URI, Factory, Resolver, Builder): Parser Like NewURI, using the file filePath.
NewURI(URI, URI, Factory, Resolver, Builder): Parser Like NewChannel, but opens the channel on the URI uri.
Method Summary
ParseDocument() Parses the document, issuing callbacks to Builder.Builder as it goes along.

Type Summary
[NameList] = POINTER TO ARRAY OF String
[PEInfo] = RECORD ... END
[PEInfoList] = POINTER TO ARRAY OF PEInfo

Procedure Summary
IsNameChar(Char): BOOLEAN
IsNameChar0(Char): BOOLEAN

Class Detail: ErrorListener

Method Detail

### Error

    PROCEDURE (el: ErrorListener) Error(context: Context;
                    code: Code;
                    fatalError: BOOLEAN;
                    pos: Position): Msg

> Adds a new error message to the parser error list. context and code determine the message text. If fatalError is TRUE, then the parser should stop reporting any events to the application. pos indicates the position of the error. It should be taken from a locator.

> [Description inherited from Error]

> Redefines: Error

Class Detail: Parser

Field Detail

### enforceQNames

    FIELD enforceQNames: BOOLEAN

> If TRUE, then the parser checks that element and attribute names also match the production ``QName`', and that entity names, PI targets, and notation names contain no colon. This enables parts of the checks required from namespace aware parsers. The default is FALSE.

### errList

    FIELD errList-: List

> Holds all error messages related to the currently parsed XML document. After an error occured, ``errList.msgCount`' is no longer zero.

### followExternalRef

    FIELD followExternalRef: BOOLEAN

> If TRUE, then the parser should try to follow external references (references to the external DTD subset or to an external parameter entity). It is an error if the external entity cannot be read. The default value is TRUE.

### validating

    FIELD validating: BOOLEAN

> If TRUE, then the parser checks that

> - parameter entity references are expanded,

> - parameter entity references do not violate the nesting requirements imposed by the various validity constraints,

> - required attributes are present in an element's attribute list,

> The default value of this field is FALSE. Only use this setting in conjunction with a builder of type XML:Builder:Validator.Builder.

Constructor Detail

### NewChannel

    PROCEDURE NewChannel(ch: ByteChannel;
                         baseURI: URI;
                         codecFactory: Factory;
                         entityResolver: Resolver;
                         builder: Builder): Parser
      RAISES Error;

> Creates a new parser for the input channel ch. baseURI is the absolute URI of the document entity, as computed by the method of RFC 2396, if that is known. If this value is NIL, or refers to an opaque URI, then relative URIs in the document cannot be resolved.

> codecFactory designates the decoder that should be used to read the byte stream from ch. If this is NIL, then autodetection is done on the input encoding. If everything fails, the decoder defaults to UTF8.factory.

> The entity resolver entityResolver is used to map public and system identifiers of the document to absolute URIs. If it is NIL, entities are exclusively resolved through their system identifier.

> The interface to the application is the builder instance builder. During parsing, the parser will call the methods of this object.

### NewExternalID

    PROCEDURE NewExternalID(public: ARRAY OF Char;
                            system: ARRAY OF Char;
                            systemBaseURI: URI;
                            codecFactory: Factory;
                            entityResolver: Resolver;
                            builder: Builder;
                            VAR res: Msg): Parser
      RAISES Error;

> Like NewURI, using the given public or system identifier. The external identifiers are mapped to an absolute URI using entityResolver.

### NewFile

    PROCEDURE NewFile(filePath: ARRAY OF CHAR;
                      baseURI: URI;
                      codecFactory: Factory;
                      entityResolver: Resolver;
                      builder: Builder): Parser
      RAISES Error;

> Like NewURI, using the file filePath.

### NewURI

    PROCEDURE NewURI(uri: URI;
                     baseURI: URI;
                     codecFactory: Factory;
                     entityResolver: Resolver;
                     builder: Builder): Parser
      RAISES Error;

> Like NewChannel, but opens the channel on the URI uri.

Method Detail

### ParseDocument

    PROCEDURE (p: Parser) ParseDocument()
      RAISES Error;

> Parses the document, issuing callbacks to Builder.Builder as it goes along. After completion, any errors are reported in p.errList.

Type Detail

### NameList

    TYPE [NameList] = POINTER TO ARRAY OF String

### PEInfo

    TYPE [PEInfo] = RECORD
                  END

### PEInfoList

    TYPE [PEInfoList] = POINTER TO ARRAY OF PEInfo

Procedure Detail

### IsNameChar

    PROCEDURE IsNameChar(ch: Char): BOOLEAN

### IsNameChar0

    PROCEDURE IsNameChar0(ch: Char): BOOLEAN