Spec-Zone .ru
спецификации, руководства, описания, API
Spec-Zone .ru
спецификации, руководства, описания, API
Библиотека разработчика Mac Разработчик
Поиск

 

Эта страница руководства для  версии 10.9 Mac OS X

Если Вы выполняете различную версию  Mac OS X, просматриваете документацию локально:

Читать страницы руководства

Страницы руководства предназначаются как справочник для людей, уже понимающих технологию.

  • Чтобы изучить, как руководство организовано или узнать о синтаксисе команды, прочитайте страницу руководства для страниц справочника (5).

  • Для получения дополнительной информации об этой технологии, ищите другую документацию в Библиотеке Разработчика Apple.

  • Для получения общей информации о записи сценариев оболочки, считайте Shell, Пишущий сценарий Учебника для начинающих.



TclXML(n)                                                                                          TclXML(n)



Steve Ball'
____________________________________________________________________________________________________________

NAME
       ::xml::parser - XML parser support for Tcl

SYNOPSIS
       package require xml

       package require parserclass

       xml2.6

       ::xml::sgml::xml::tclparser

       ::xml::parserclass option ? arg arg ... ?

       ::xml::parser ? name? ? -option value ... ?

       parser option arg
____________________________________________________________________________________________________________


DESCRIPTION
       TclXML  provides event-based parsing of XML documents.  The application may register callback scripts
       for certain document features, and when the parser encounters those features while parsing the  docu-ment document
       ment the callback is evaluated.


       The  parser  may also perform other functions, such as normalisation, validation and/or entity expan-sion. expansion.
       sion.  Generally, these functions are under the control  of  configuration  options.   Whether  these
       functions can be performed at all depends on the parser implementation.


       The  TclXML package provides a generic interface for use by a Tcl application, along with a low-level
       interface for use by a parser implementation.  Each implementation provides a class  of  XML  parser,
       and  these  register  themselves  using the ::xml::parserclass create command.  One of the registered
       parser classes will be the default parser class.


       Loading the package with the generic package require xml command allows the package to  automatically
       determine  the  default  parser  class.  In order to select a particular parser class as the default,
       that class' package may be loaded directly, eg. package require expat.  In all cases,  all  available
       parser  classes are registered with the TclXML package, the difference is simply in which one becomes
       the default.


COMMANDS
       ::xml::parserclass


       The ::xml::parserclass command is used to manage XML parser classes.


              Command Options


              The following command options may be used:



                     create  create name ? -createcommand script? ? -createentityparsercommand
                     script? ? -parsecommand script? ? -configurecommand script? ? -getcommand
                     script? ? -deletecommand script?

                     Creates an XML parser class with the given name.


                     destroy  destroy name

                     Destroys an XML parser class.


                     info  info names

                     Returns information about registered XML parser classes.



       ::xml::parser


       The ::xml::parser command creates an XML parser object.  The return value of  the  com-mand command
       mand is the name of the newly created parser.


       The  parser  scans an XML document's syntactical structure, evaluating callback scripts
       for each feature found.  At the very least the parser will normalise the  document  and
       check  the  document  for well-formedness.  If the document is not well-formed then the
       -errorcommand option will be evaluated.  Some parser  classes  may  perform  additional
       functions,  such  as  validation.   Additional  features provided by the various parser
       classes are described in the section Parser Classes


       Parsing is performed synchronously.  The command blocks until the entire  document  has
       been  parsed.   Parsing  may  be terminated by an application callback, see the section
       Callback Return Codes.  Incremental parsing is also supported by using the  -final con-figuration configuration
       figuration option.


              Configuration Options


              The ::xml::parser command accepts the following configuration options:



                      -attlistdeclcommand  -attlistdeclcommand script

                     Specifies the prefix of a Tcl command to be evaluated when-ever whenever
                     ever an attribute list declaration is  encountered  in  the
                     DTD  subset  of an XML document.  The command evaluated is:
                     script name attrname type default value

                     where:



                            name Element type name

                            attrname Attribute  name  being
                            declared

                            type Attribute type

                            default Attribute default, such
                            as #IMPLIED

                            value Default attribute  value.
                            Empty string if none given.


                      -baseurl  -baseurl URI

                     Specifies the base URI  for  resolving
                     relative  URIs that may be used in the
                     XML  document  to  refer  to  external
                     entities.


                      -characterdatacommand  -characterdat-acommand -characterdatacommand
                     acommand script

                     Specifies  the prefix of a Tcl command
                     to  be  evaluated  whenever  character
                     data  is  encountered in the XML docu-ment document
                     ment being parsed.  The command evalu-ated evaluated
                     ated is: script data

                     where:



                            data Char-acter Character
                            acter data
                            in     the
                            document


                      -commentcommand
                     -commentcommand
                     script

                     Specifies     the
                     prefix of  a  Tcl
                     command   to   be
                     evaluated   when-ever whenever
                     ever a comment is
                     encountered    in
                     the  XML document
                     being     parsed.
                     The command eval-uated evaluated
                     uated is:  script
                     data

                     where:




                                   data
                                   Com-ment Comment
                                   ment
                                   data


                      -default-com -defaultcom
com-mand command
                     mand
                     -default-com -defaultcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     no
                     other
                     call-back callback
                     back
                     has
                     been
                     defined
                     for
                     a
                     doc-u docu
u-ment ument
                     ment
                     fea-ture feature
                     ture
                     which
                     has
                     been
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     data

                     where:




                                   data
                                   Doc-u Docu
u-ment ument
                                   ment
                                   data


                      -defaul-t -default
t-ex tex
ex-pand expand
pand-in pandin
in-ter inter
ter-nalen ternalen
nalen-ti nalenti
ti-ties tities
                     ties
                     -defaul-t -default
t-ex tex
ex-pand expand
pand-in pandin
in-ter inter
ter-nalen ternalen
nalen-ti nalenti
ti-ties tities
                     ties
                     boolean

                     Spec-i Speci
i-fies ifies
                     fies
                     whether
                     enti-ties entities
                     ties
                     declared
                     in
                     the
                     inter-nal internal
                     nal
                     DTD
                     sub-set subset
                     set
                     are
                     expanded
                     with
                     their
                     replace-ment replacement
                     ment
                     text.
                     If
                     enti-ties entities
                     ties
                     are
                     not
                     expanded
                     then
                     the
                     entity
                     ref-er refer
er-ences erences
                     ences
                     will
                     be
                     reported
                     with
                     no
                     expan-sion. expansion.
                     sion.


                      -doc-type -doctype
type-com typecom
com-mand command
                     mand
                     -doc-type -doctype
type-com typecom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     the
                     doc-u docu
u-ment ument
                     ment
                     type
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     pub-lic public
                     lic
                     sys-tem system
                     tem
                     dtd

                     where:




                                   name
                                   The
                                   name
                                   of
                                   the
                                   doc-u docu
u-ment ument
                                   ment
                                   ele-ment element
                                   ment

                            pub-lic public
                                   lic
                                   Pub-lic Public
                                   lic
                                   iden-ti identi
ti-fier tifier
                                   fier
                                   for
                                   the
                                   exter-nal external
                                   nal
                                   DTD
                                   sub-set subset
                                   set

                            sys-tem system
                                   tem
                                   Sys-tem System
                                   tem
                                   iden-ti identi
ti-fier tifier
                                   fier
                                   for
                                   the
                                   exter-nal external
                                   nal
                                   DTD
                                   sub-set. subset.
                                   set.
                                   Usu-ally Usually
                                   ally
                                   a
                                   URI.

                            dtd
                                   The
                                   inter-nal internal
                                   nal
                                   DTD
                                   sub-set subset
                                   set


                     See
                     also
                     -start-doc -startdoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand clcommand
                     mand
                     and
                     -end-doc -enddoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand. clcommand.
                     mand.


                      -ele-ment -element
ment-de mentde
de-clcom declcom
clcom-mand clcommand
                            mand
                            -ele-ment -element
ment-de mentde
de-clcom declcom
clcom-mand clcommand
                            mand
                            script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     an
                     ele-ment element
                     ment
                     markup
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     model

                     where:




                                   name
                                   The
                                   ele-ment element
                                   ment
                                   type
                                   name

                            model
                                   Con-tent Content
                                   tent
                                   model
                                   spec-i speci
i-fi ifi
fi-ca fica
ca-tion cation
                                   tion


                      -ele-mentend -elementend
mentend-com mentendcom
com-mand command
                     mand
                     -ele-mentend -elementend
mentend-com mentendcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     an
                     ele-ment element
                     ment
                     end
                     tag
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     args

                     where:




                                   name
                                   The
                                   ele-ment element
                                   ment
                                   type
                                   name
                                   that
                                   has
                                   ended

                            args
                                   Addi-tional Additional
                                   tional
                                   infor-ma informa
ma-tion mation
                                   tion
                                   about
                                   this
                                   ele-ment element
                                   ment


                     Addi-tional Additional
                     tional
                     infor-ma informa
ma-tion mation
                     tion
                     about
                     the
                     ele-ment element
                     ment
                     takes
                     the
                     form
                     of
                     con-fig config
fig-u figu
u-ra ura
ra-tion ration
                     tion
                     options.
                     Pos-si Possi
si-ble sible
                     ble
                     options
                     are:



                            -empty
                            boolean
                            The
                            empty
                            ele-ment element
                            ment
                            syn-tax syntax
                            tax
                            was
                            used
                            for
                            this
                            ele-ment element
                            ment

                            -names-pace -namespace
                            pace
                            uri
                            The
                            ele-ment element
                            ment
                            is
                            in
                            the
                            XML
                            names-pace namespace
                            pace
                            asso-ci associ
ci-ated ciated
                            ated
                            with
                            the
                            given
                            URI


                      -ele-mentstart -elementstart
mentstart-com mentstartcom
com-mand command
                     mand
                     -ele-mentstart -elementstart
mentstart-com mentstartcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     an
                     ele-ment element
                     ment
                     start
                     tag
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     attlist
                     args

                     where:



                            name
                            The
                            ele-ment element
                            ment
                            type
                            name
                            that
                            has
                            started

                            attlist
                            A
                            Tcl
                            list
                            con-tain contain
tain-ing taining
                            ing
                            the
                            attributes
                            for
                            this
                            ele-ment. element.
                            ment.
                            The
                            list
                            of
                            attributes
                            is
                            for-mat format
mat-ted matted
                            ted
                            as
                            pairs
                            of
                            attribute
                            names
                            and
                            their
                            val-ues. values.
                            ues.

                            args
                                   Addi-tional Additional
                                   tional
                                   infor-ma informa
ma-tion mation
                                   tion
                                   about
                                   this
                                   ele-ment element
                                   ment


                     Addi-tional Additional
                     tional
                     infor-ma informa
ma-tion mation
                     tion
                     about
                     the
                     ele-ment element
                     ment
                     takes
                     the
                     form
                     of
                     con-fig config
fig-u figu
u-ra ura
ra-tion ration
                     tion
                     options.
                     Pos-si Possi
si-ble sible
                     ble
                     options
                     are:



                            -empty
                            boolean
                            The
                            empty
                            ele-ment element
                            ment
                            syn-tax syntax
                            tax
                            was
                            used
                            for
                            this
                            ele-ment element
                            ment

                            -names-pace -namespace
                            pace
                            uri
                            The
                            ele-ment element
                            ment
                            is
                            in
                            the
                            XML
                            names-pace namespace
                            pace
                            asso-ci associ
ci-ated ciated
                            ated
                            with
                            the
                            given
                            URI

                            -names-pacede -namespacede
pacede-cls pacedecls
                            cls
                            list
                            The
                            start
                            tag
                            included
                            one
                            or
                            more
                            XML
                            Names-pace Namespace
                            pace
                            dec-la decla
la-ra lara
ra-tions. rations.
                            tions.
                            list
                            is
                            a
                            Tcl
                            list
                            giv-ing giving
                            ing
                            the
                            names-paces namespaces
                            paces
                            declared.
                            The
                            list
                            is
                            for-mat format
mat-ted matted
                            ted
                            as
                            pairs
                            of
                            val-ues, values,
                            ues,
                            the
                            first
                            value
                            is
                            the
                            names-pace namespace
                            pace
                            URI
                            and
                            the
                            sec-ond second
                            ond
                            value
                            is
                            the
                            pre-fix prefix
                            fix
                            used
                            for
                            the
                            names-pace namespace
                            pace
                            in
                            this
                            doc-u docu
u-ment. ument.
                            ment.
                            A
                            default
                            XML
                            names-pace namespace
                            pace
                            dec-la decla
la-ra lara
ra-tion ration
                            tion
                            will
                            have
                            an
                            empty
                            string
                            for
                            the
                            pre-fix. prefix.
                            fix.


                      -end-c -endc
c-data cdata
data-sec datasec
sec-tion section
tion-com tioncom
com-mand command
                            mand
                            -end-c -endc
c-data cdata
data-sec datasec
sec-tion section
tion-com tioncom
com-mand command
                            mand
                            script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     end
                     of
                     a
                     CDATA
                     sec-tion section
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     is
                     eval-u evalu
u-ated uated
                     ated
                     with
                     no
                     fur-ther further
                     ther
                     argu-ments. arguments.
                     ments.


                      -end-doc -enddoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand clcommand
                            mand
                            -end-doc -enddoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand clcommand
                            mand
                            script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     end
                     of
                     the
                     doc-u docu
u-ment ument
                     ment
                     type
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     is
                     eval-u evalu
u-ated uated
                     ated
                     with
                     no
                     fur-ther further
                     ther
                     argu-ments. arguments.
                     ments.


                      -enti-ty -entity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     -enti-ty -entity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     an
                     entity
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     args

                     where:



                            name
                            The
                            name
                            of
                            the
                            entity
                            being
                            declared

                            args
                            Addi-tional Additional
                            tional
                            infor-ma informa
ma-tion mation
                            tion
                            about
                            the
                            entity
                            dec-la decla
la-ra lara
ra-tion. ration.
                            tion.
                            An
                            inter-nal internal
                            nal
                            entity
                            shall
                            have
                            a
                            sin-gle single
                            gle
                            argu-ment, argument,
                            ment,
                            the
                            replace-ment replacement
                            ment
                            text.
                            An
                            exter-nal external
                            nal
                            parsed
                            entity
                            shall
                            have
                            two
                            addi-tional additional
                            tional
                            argu-ments, arguments,
                            ments,
                            the
                            pub-lic public
                            lic
                            and
                            sys-tem system
                            tem
                            inden-ti indenti
ti-fiers tifiers
                            fiers
                            of
                            the
                            exter-nal external
                            nal
                            resource.
                            An
                            exter-nal external
                            nal
                            unparsed
                            entity
                            shall
                            have
                            three
                            addi-tional additional
                            tional
                            argu-ments, arguments,
                            ments,
                            the
                            pub-lic public
                            lic
                            and
                            sys-tem system
                            tem
                            iden-ti identi
ti-fiers tifiers
                            fiers
                            fol-lowed followed
                            lowed
                            by
                            the
                            nota-tion notation
                            tion
                            name.


                      -enti-tyref -entityref
tyref-er tyrefer
er-ence erence
ence-com encecom
com-mand command
                     mand
                     -enti-tyref -entityref
tyref-er tyrefer
er-ence erence
ence-com encecom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     an
                     entity
                     ref-er refer
er-ence erence
                     ence
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name

                     where:




                                   name
                                   The
                                   name
                                   of
                                   the
                                   entity
                                   being
                                   ref-er refer
er-enced erenced
                                   enced


                      -errro-com -errrocom
com-mand command
                     mand
                     -error-com -errorcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     fatal
                     error
                     is
                     detected.
                     The
                     error
                     may
                     be
                     due
                     to
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     not
                     being
                     well-formed. wellformed.
                     formed.
                     In
                     the
                     case
                     of
                     a
                     val-i vali
i-dat idat
dat-ing dating
                     ing
                     parser
                     class,
                     the
                     error
                     may
                     also
                     be
                     due
                     to
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     not
                     obey-ing obeying
                     ing
                     valid-ity validity
                     ity
                     con-straints. constraints.
                     straints.
                     By
                     default,
                     a
                     call-back callback
                     back
                     script
                     is
                     pro-vided provided
                     vided
                     which
                     causes
                     an
                     error
                     return
                     code,
                     but
                     an
                     appli-ca applica
ca-tion cation
                     tion
                     may
                     sup-ply supply
                     ply
                     a
                     script
                     which
                     attempts
                     to
                     con-tinue continue
                     tinue
                     pars-ing. parsing.
                     ing.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     error-code errorcode
                     code
                     errormsg

                     where:



                            error-code errorcode
                            code
                            A
                            sin-gle single
                            gle
                            word
                            descrip-tion description
                            tion
                            of
                            the
                            error,
                            intended
                            for
                            use
                            by
                            an
                            appli-ca applica
ca-tion cation
                            tion

                            errormsg
                            A
                            human-read humanread
read-able readable
                            able
                            descrip-tion description
                            tion
                            of
                            the
                            error


                      -exter-nalen -externalen
nalen-ti nalenti
ti-ty tity
ty-com tycom
com-mand command
                     mand
                     -exter-nalen -externalen
nalen-ti nalenti
ti-ty tity
ty-com tycom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     to
                     resolve
                     an
                     exter-nal external
                     nal
                     entity
                     ref-er refer
er-ence. erence.
                     ence.
                     If
                     the
                     parser
                     has
                     been
                     con-fig config
fig-ured figured
                     ured
                     to
                     val-i vali
i-date idate
                     date
                     the
                     XML
                     doc-u docu
u-ment, ument,
                     ment,
                     a
                     default
                     script
                     is
                     sup-plied supplied
                     plied
                     that
                     resolves
                     the
                     URI
                     given
                     as
                     the
                     sys-tem system
                     tem
                     iden-ti identi
ti-fier tifier
                     fier
                     of
                     the
                     exter-nal external
                     nal
                     entity
                     and
                     recur-sively recursively
                     sively
                     parses
                     the
                     entity's
                     data.
                     If
                     the
                     parser
                     has
                     been
                     con-fig config
fig-ured figured
                     ured
                     as
                     a
                     non-val nonval
val-i vali
i-dat idat
dat-ing dating
                     ing
                     parser,
                     then
                     by
                     default
                     exter-nal external
                     nal
                     enti-ties entities
                     ties
                     are
                     not
                     resolved.
                     This
                     option
                     can
                     be
                     used
                     to
                     over-ride override
                     ride
                     the
                     default
                     be-hav behav
hav-iour. haviour.
                     iour.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     baseuri
                     uri
                     id

                     where:




                                   name
                                   The
                                   Tcl
                                   com-mand command
                                   mand
                                   name
                                   of
                                   the
                                   cur-rent current
                                   rent
                                   parser

                            baseuri
                            An
                            abso-lute absolute
                            lute
                            URI
                            for
                            the
                            cur-rent current
                            rent
                            entity
                            which
                            is
                            to
                            be
                            used
                            to
                            resolve
                            rel-a rela
a-tive ative
                            tive
                            URIs

                            uri
                            The
                            sys-tem system
                            tem
                            iden-ti identi
ti-fier tifier
                            fier
                            of
                            the
                            exter-nal external
                            nal
                            entity,
                            usu-ally usually
                            ally
                            a
                            URI

                            id
                            The
                            pub-lic public
                            lic
                            iden-ti identi
ti-fier tifier
                            fier
                            of
                            the
                            exter-nal external
                            nal
                            entity.
                            If
                            no
                            pub-lic public
                            lic
                            iden-ti identi
ti-fier tifier
                            fier
                            was
                            given
                            in
                            the
                            entity
                            dec-la decla
la-ra lara
ra-tion ration
                            tion
                            then
                            id
                            will
                            be
                            an
                            empty
                            string.


                      -final
                     -final
                     boolean

                     Spec-i Speci
i-fies ifies
                     fies
                     whether
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     being
                     parsed
                     is
                     com-plete. complete.
                     plete.
                     If
                     the
                     doc-u docu
u-ment ument
                     ment
                     is
                     to
                     be
                     incre-men incremen
men-tally mentally
                     tally
                     parsed
                     then
                     this
                     option
                     will
                     be
                     set
                     to
                     false,
                     and
                     when
                     the
                     last
                     frag-ment fragment
                     ment
                     of
                     doc-u docu
u-ment ument
                     ment
                     is
                     parsed
                     it
                     is
                     set
                     to
                     true.
                     For
                     exam-ple, example,
                     ple,


                            set parser [::xml::parser -final 0]
                            $parser parse $data1
                            $parser parse $data2
                            $parser configure -final 1
                            $parser parse $finaldata



                      -ignorewhites-pace -ignorewhitespace
                     pace
                     -ignorewhites-pace -ignorewhitespace
                     pace
                     boolean

                     If
                     this
                     option
                     is
                     set
                     to
                     true
                     then
                     spans
                     of
                     char-ac charac
ac-ter acter
                     ter
                     data
                     in
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     which
                     are
                     com-posed composed
                     posed
                     only
                     of
                     white-space whitespace
                     space
                     (CR,
                     LF,
                     space,
                     tab)
                     will
                     not
                     be
                     reported
                     to
                     the
                     appli-ca applica
ca-tion. cation.
                     tion.
                     In
                     other
                     words,
                     the
                     data
                     passed
                     to
                     every
                     invo-ca invoca
ca-tion cation
                     tion
                     of
                     the
                     -char-ac -charac
ac-ter acter
ter-dat terdat
dat-a data
a-com acom
com-mand command
                     mand
                     script
                     will
                     con-tain contain
                     tain
                     at
                     least
                     one
                     non-white nonwhite
white-space whitespace
                     space
                     char-ac charac
ac-ter. acter.
                     ter.


                      -nota-tion -notation
tion-de tionde
de-clcom declcom
clcom-mand clcommand
                     mand
                     -nota-tion -notation
tion-de tionde
de-clcom declcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     nota-tion notation
                     tion
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     uri

                     where:




                                   name
                                   The
                                   name
                                   of
                                   the
                                   nota-tion notation
                                   tion

                            uri
                                   An
                                   exter-nal external
                                   nal
                                   iden-ti identi
ti-fier tifier
                                   fier
                                   for
                                   the
                                   nota-tion, notation,
                                   tion,
                                   usu-ally usually
                                   ally
                                   a
                                   URI.


                      -not-stan -notstan
stan-dalonecom standalonecom
dalonecom-mand dalonecommand
                     mand
                     -not-stan -notstan
stan-dalonecom standalonecom
dalonecom-mand dalonecommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     the
                     parser
                     deter-mines determines
                     mines
                     that
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     being
                     parsed
                     is
                     not
                     a
                     stand-alone standalone
                     alone
                     doc-u docu
u-ment. ument.
                     ment.


                      -para-men -paramen
men-ti menti
ti-ty tity
ty-pars typars
pars-ing parsing
                     ing
                     -para-men -paramen
men-ti menti
ti-ty tity
ty-pars typars
pars-ing parsing
                     ing
                     boolean

                     Con-trols Controls
                     trols
                     whether
                     exter-nal external
                     nal
                     param-e parame
e-ter eter
                     ter
                     enti-ties entities
                     ties
                     are
                     parsed.


                      -param-e -parame
e-ter eter
ter-en teren
en-ti enti
ti-ty tity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     -param-e -parame
e-ter eter
ter-en teren
en-ti enti
ti-ty tity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     param-e parame
e-ter eter
                     ter
                     entity
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     name
                     args

                     where:




                                   name
                                   The
                                   name
                                   of
                                   the
                                   param-e parame
e-ter eter
                                   ter
                                   entity

                            args
                            For
                            an
                            inter-nal internal
                            nal
                            param-e parame
e-ter eter
                            ter
                            entity
                            there
                            is
                            only
                            one
                            addi-tional additional
                            tional
                            argu-ment, argument,
                            ment,
                            the
                            replace-ment replacement
                            ment
                            text.
                            For
                            exter-nal external
                            nal
                            param-e parame
e-ter eter
                            ter
                            enti-ties entities
                            ties
                            there
                            are
                            two
                            addi-tional additional
                            tional
                            argu-ments, arguments,
                            ments,
                            the
                            sys-tem system
                            tem
                            and
                            pub-lic public
                            lic
                            iden-ti identi
ti-fiers tifiers
                            fiers
                            respec-tively. respectively.
                            tively.


                      -parser
                     -parser
                     name

                     The
                     name
                     of
                     the
                     parser
                     class
                     to
                     instan-ti instanti
ti-ate tiate
                     ate
                     for
                     this
                     parser
                     object.
                     This
                     option
                     may
                     only
                     be
                     spec-i speci
i-fied ified
                     fied
                     when
                     the
                     parser
                     instance
                     is
                     cre-ated. created.
                     ated.


                      -pro-cessin -processin
cessin-gin cessingin
gin-struc ginstruc
struc-tion struction
tion-com tioncom
com-mand command
                     mand
                     -pro-cessin -processin
cessin-gin cessingin
gin-struc ginstruc
struc-tion struction
tion-com tioncom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     pro-cess process
cess-ing cessing
                     ing
                     instruc-tion instruction
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     tar-get target
                     get
                     data

                     where:



                            tar-get target
                            get
                            The
                            name
                            of
                            the
                            pro-cess process
cess-ing cessing
                            ing
                            instruc-tion instruction
                            tion
                            tar-get target
                            get

                            data
                            Remain-ing Remaining
                            ing
                            data
                            from
                            the
                            pro-cess process
cess-ing cessing
                            ing
                            instruc-tion instruction
                            tion


                      -reportempty
                     -reportempty
                     boolean

                     If
                     this
                     option
                     is
                     enabled
                     then
                     when
                     an
                     ele-ment element
                     ment
                     is
                     encoun-tered encountered
                     tered
                     that
                     uses
                     the
                     spe-cial special
                     cial
                     empty
                     ele-ment element
                     ment
                     syn-tax, syntax,
                     tax,
                     addi-tional additional
                     tional
                     argu-ments arguments
                     ments
                     are
                     appended
                     to
                     the
                     -ele-mentstart -elementstart
mentstart-com mentstartcom
com-mand command
                     mand
                     and
                     -ele-mentend -elementend
mentend-com mentendcom
com-mand command
                     mand
                     call-backs. callbacks.
                     backs.
                     The
                     argu-ments arguments
                     ments
                     -empty
                     1
                     are
                     appended.
                     For
                     exam-ple: example:
                     ple:
                     script
                     -empty
                     1

                      -startc-data -startcdata
data-sec datasec
sec-tion section
tion-com tioncom
com-mand command
                     mand
                     -startc-data -startcdata
data-sec datasec
sec-tion section
tion-com tioncom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     the
                     start
                     of
                     a
                     CDATA
                     sec-tion section
                     tion
                     sec-tion section
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     No
                     argu-ments arguments
                     ments
                     are
                     appended
                     to
                     the
                     script.


                      -start-doc -startdoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand clcommand
                     mand
                     -start-doc -startdoc
doc-type doctype
type-de typede
de-clcom declcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     at
                     the
                     start
                     of
                     a
                     doc-u docu
u-ment ument
                     ment
                     type
                     dec-la decla
la-ra lara
ra-tion. ration.
                     tion.
                     No
                     argu-ments arguments
                     ments
                     are
                     appended
                     to
                     the
                     script.


                      -unknow-nen -unknownen
nen-cod nencod
cod-ing coding
ing-com ingcom
com-mand command
                     mand
                     -unknow-nen -unknownen
nen-cod nencod
cod-ing coding
ing-com ingcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     char-ac charac
ac-ter acter
                     ter
                     is
                     encoun-tered encountered
                     tered
                     with
                     an
                     unknown
                     encod-ing. encoding.
                     ing.
                     This
                     option
                     has
                     not
                     been
                     imple-mented. implemented.
                     mented.


                      -unparseden-ti -unparsedenti
ti-ty tity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     -unparseden-ti -unparsedenti
ti-ty tity
ty-de tyde
de-clcom declcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered encountered
                     tered
                     for
                     an
                     unparsed
                     entity.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     sys-tem system
                     tem
                     pub-lic public
                     lic
                     nota-tion notation
                     tion

                     where:



                            sys-tem system
                            tem
                            The
                            sys-tem system
                            tem
                            iden-ti identi
ti-fier tifier
                            fier
                            of
                            the
                            exter-nal external
                            nal
                            entity,
                            usu-ally usually
                            ally
                            a
                            URI

                            pub-lic public
                                   lic
                                   The
                                   pub-lic public
                                   lic
                                   iden-ti identi
ti-fier tifier
                                   fier
                                   of
                                   the
                                   exter-nal external
                                   nal
                                   entity

                            nota-tion notation
                                   tion
                                   The
                                   name
                                   of
                                   the
                                   nota-tion notation
                                   tion
                                   for
                                   the
                                   exter-nal external
                                   nal
                                   entity


                      -val-i -vali
i-date idate
                     date
                     -val-i -vali
i-date idate
                     date
                     boolean

                     Enables
                     val-i vali
i-da ida
da-tion dation
                     tion
                     of
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     to
                     be
                     parsed.
                     Any
                     changes
                     to
                     this
                     option
                     are
                     ignored
                     after
                     an
                     XML
                     doc-u docu
u-ment ument
                     ment
                     has
                     started
                     to
                     be
                     parsed,
                     but
                     the
                     option
                     may
                     be
                     changed
                     after
                     a
                     reset.


                      -warn-ing -warning
ing-com ingcom
com-mand command
                     mand
                     -warn-ing -warning
ing-com ingcom
com-mand command
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     a
                     warn-ing warning
                     ing
                     con-di condi
di-tion dition
                     tion
                     is
                     detected.
                     A
                     warn-ing warning
                     ing
                     con-di condi
di-tion dition
                     tion
                     is
                     where
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     has
                     not
                     been
                     authored
                     cor-rectly, correctly,
                     rectly,
                     but
                     is
                     still
                     well-formed wellformed
                     formed
                     and
                     may
                     be
                     valid.
                     For
                     exam-ple, example,
                     ple,
                     the
                     spe-cial special
                     cial
                     empty
                     ele-ment element
                     ment
                     syn-tax syntax
                     tax
                     may
                     be
                     used
                     for
                     an
                     ele-ment element
                     ment
                     which
                     has
                     not
                     been
                     declared
                     to
                     have
                     empty
                     con-tent. content.
                     tent.
                     By
                     default,
                     a
                     call-back callback
                     back
                     script
                     is
                     pro-vided provided
                     vided
                     which
                     silently
                     ignores
                     the
                     warn-ing. warning.
                     ing.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     warn-ing warning
ing-code ingcode
                     code
                     warn-ingmsg warningmsg
                     ingmsg

                     where:



                            warn-ing warning
ing-code ingcode
                            code
                            A
                            sin-gle single
                            gle
                            word
                            descrip-tion description
                            tion
                            of
                            the
                            warn-ing, warning,
                            ing,
                            intended
                            for
                            use
                            by
                            an
                            appli-ca applica
ca-tion cation
                            tion

                            wan-ringmsg wanringmsg
                            ringmsg
                            A
                            human-read humanread
read-able readable
                            able
                            descrip-tion description
                            tion
                            of
                            the
                            warn-ing warning
                            ing


                      -xmlde-clcom -xmldeclcom
clcom-mand clcommand
                     mand
                     -xmlde-clcom -xmldeclcom
clcom-mand clcommand
                     mand
                     script

                     Spec-i Speci
i-fies ifies
                     fies
                     the
                     pre-fix prefix
                     fix
                     of
                     a
                     Tcl
                     com-mand command
                     mand
                     to
                     be
                     eval-u evalu
u-ated uated
                     ated
                     when
                     the
                     XML
                     dec-la decla
la-ra lara
ra-tion ration
                     tion
                     is
                     encoun-tered. encountered.
                     tered.
                     The
                     com-mand command
                     mand
                     eval-u evalu
u-ated uated
                     ated
                     is:
                     script
                     ver-sion version
                     sion
                     encod-ing encoding
                     ing
                     stand-alone standalone
                     alone

                     where:




                                   ver-sion version
                                   sion
                                   The
                                   ver-sion version
                                   sion
                                   num-ber number
                                   ber
                                   of
                                   the
                                   XML
                                   spec-i speci
i-fi ifi
fi-ca fica
ca-tion cation
                                   tion
                                   to
                                   which
                                   this
                                   doc-u docu
u-ment ument
                                   ment
                                   pur-ports purports
                                   ports
                                   to
                                   con-form conform
                                   form

                            encod-ing encoding
                                   ing
                                   The
                                   char-ac charac
ac-ter acter
                                   ter
                                   encod-ing encoding
                                   ing
                                   of
                                   the
                                   doc-u docu
u-ment ument
                                   ment

                            stand-alone standalone
                            alone
                            A
                            boolean
                            declar-ing declaring
                            ing
                            whether
                            the
                            doc-u docu
u-ment ument
                            ment
                            is
                            stand-alone standalone
                            alone


              Parser
                     Com-mand Command
                     mand

              The
              ::xml::parser
              com-mand command
              mand
              cre-ates creates
              ates
              a
              new
              Tcl
              com-mand command
              mand
              with
              the
              same
              name
              as
              the
              parser.
              This
              com-mand command
              mand
              may
              be
              used
              to
              invoke
              var-i vari
i-ous ious
              ous
              oper-a opera
a-tions ations
              tions
              on
              the
              parser
              object.
              It
              has
              the
              fol-low follow
low-ing lowing
              ing
              gen-eral general
              eral
              form:
              name
              option
              arg

               option
              and
              the
              arg
              deter-mine determine
              mine
              the
              exact
              be-hav behav
hav-iour haviour
              iour
              of
              the
              com-mand. command.
              mand.
              The
              fol-low follow
low-ing lowing
              ing
              com-mands commands
              mands
              are
              pos-si possi
si-ble sible
              ble
              for
              parser
              objects:



                      cget
                     cget
                     -option

                     Returns
                     the
                     cur-rent current
                     rent
                     value
                     of
                     the
                     con-fig config
fig-u figu
u-ra ura
ra-tion ration
                     tion
                     option
                     given
                     by
                     option.
                     Option
                     may
                     have
                     any
                     of
                     the
                     val-ues values
                     ues
                     accepted
                     by
                     the
                     parser
                     object.


                      con-fig config
fig-ure figure
                     ure
                     con-fig config
fig-ure figure
                     ure
                     ?
                     -option
                     value
                     ...
                     ?

                     Mod-ify Modify
                     ify
                     the
                     con-fig config
fig-u figu
u-ra ura
ra-tion ration
                     tion
                     options
                     of
                     the
                     parser
                     object.
                     Option
                     may
                     have
                     any
                     of
                     the
                     val-ues values
                     ues
                     accepted
                     by
                     the
                     parser
                     object.


                      enti-ty entity
ty-parser typarser
                            parser
                            enti-ty entity
ty-parser typarser
                            parser
                            ?
                            option
                            value
                            ...
                            ?

                     Cre-ates Creates
                     ates
                     a
                     new
                     parser
                     object.
                     The
                     new
                     object
                     inher-its inherits
                     its
                     the
                     same
                     con-fig config
fig-u figu
u-ra ura
ra-tion ration
                     tion
                     options
                     as
                     the
                     par-ent parent
                     ent
                     parser
                     object,
                     but
                     is
                     able
                     to
                     parse
                     XML
                     data
                     in
                     a
                     parsed
                     entity.
                     The
                     option
                     -dtd-sub -dtdsub
sub-set subset
                     set
                     allows
                     markup
                     dec-la decla
la-ra lara
ra-tions rations
                     tions
                     to
                     be
                     treated
                     as
                     being
                     in
                     the
                     inter-nal internal
                     nal
                     or
                     exter-nal external
                     nal
                     DTD
                     sub-set. subset.
                     set.


                      free
                            free
                            name

                     Frees
                     all
                     resources
                     asso-ci associ
ci-ated ciated
                     ated
                     with
                     the
                     parser
                     object.
                     The
                     object
                     is
                     not
                     usable
                     after
                     this
                     com-mand command
                     mand
                     has
                     been
                     invoked.


                      get
                            get
                            name
                            args

                     Returns
                     infor-ma informa
ma-tion mation
                     tion
                     about
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     being
                     parsed.
                     Each
                     parser
                     class
                     pro-vides provides
                     vides
                     dif-fer differ
fer-ent ferent
                     ent
                     infor-ma informa
ma-tion, mation,
                     tion,
                     see
                     the
                     doc-u docu
u-men umen
men-ta menta
ta-tion tation
                     tion
                     for
                     the
                     parser
                     class.


                      parse
                            parse
                            xml
                            args

                     Parses
                     the
                     XML
                     doc-u docu
u-ment. ument.
                     ment.
                     The
                     usual
                     desired
                     effect
                     is
                     for
                     var-i vari
i-ous ious
                     ous
                     appli-ca applica
ca-tion cation
                     tion
                     call-backs callbacks
                     backs
                     to
                     be
                     eval-u evalu
u-ated. uated.
                     ated.
                     Other
                     func-tions functions
                     tions
                     will
                     also
                     be
                     per-formed performed
                     formed
                     by
                     the
                     parser
                     class,
                     at
                     the
                     very
                     least
                     this
                     includes
                     check-ing checking
                     ing
                     the
                     XML
                     doc-u docu
u-ment ument
                     ment
                     for
                     well-formed wellformed
formed-ness. formedness.
                     ness.


                      reset
                            reset

                     Ini-tialises Initialises
                     tialises
                     the
                     parser
                     object
                     in
                     prepa-ra prepara
ra-tion ration
                     tion
                     for
                     pars-ing parsing
                     ing
                     a
                     new
                     XML
                     doc-u docu
u-ment. ument.
                     ment.




CALL-BACK CALLBACK
       BACK
       RETURN
       CODES

       Every
       call-back callback
       back
       script
       eval-u evalu
u-ated uated
       ated
       by
       a
       parser
       may
       return
       a
       return
       code
       other
       than
       TCL_OK.
       Return
       codes
       are
       inter-preted interpreted
       preted
       as
       fol-lows: follows:
       lows:



              break
              Sup-presses Suppresses
              presses
              invo-ca invoca
ca-tion cation
              tion
              of
              all
              fur-ther further
              ther
              call-back callback
              back
              scripts.
              The
              parse
              method
              returns
              the
              TCL_OK
              return
              code.

              con-tinue continue
              tinue
              Sup-presses Suppresses
              presses
              invo-ca invoca
ca-tion cation
              tion
              of
              fur-ther further
              ther
              call-back callback
              back
              scripts
              until
              the
              cur-rent current
              rent
              ele-ment element
              ment
              has
              fin-ished. finished.
              ished.

              error
              Sup-presses Suppresses
              presses
              invo-ca invoca
ca-tion cation
              tion
              of
              all
              fur-ther further
              ther
              call-back callback
              back
              scripts.
              The
              parse
              method
              also
              returns
              the
              TCL_ERROR
              return
              code.

              default
              Any
              other
              return
              code
              sup-presses suppresses
              presses
              invo-ca invoca
ca-tion cation
              tion
              of
              all
              fur-ther further
              ther
              call-back callback
              back
              scripts.
              The
              parse
              method
              returns
              the
              same
              return
              code.


APPLI-CA APPLICA
CA-TION CATION
       TION
       EXAM-PLES EXAMPLES
       PLES

       This
       script
       out-puts outputs
       puts
       the
       char-ac charac
ac-ter acter
       ter
       data
       of
       an
       XML
       doc-u docu
u-ment ument
       ment
       read
       from
       stdin.


              package require xml

              proc cdata {data args} {
                  puts -nonewline $data
              }

              set parser [::xml::parser -characterdatacommand cdata]
              $parser parse [read stdin]



       This
       script
       counts
       the
       num-ber number
       ber
       of
       ele-ments elements
       ments
       in
       an
       XML
       doc-u docu
u-ment ument
       ment
       read
       from
       stdin.


              package require xml

              proc EStart {varName name attlist args} {
                  upvar #0 $varName var
                  incr var
              }

              set count 0
              set parser [::xml::parser -elementstartcommand [list EStart count]]
              $parser parse [read stdin]
              puts "The XML document contains $count elements"



PARSER
       CLASSES

       This
       sec-tion section
       tion
       will
       dis-cuss discuss
       cuss
       how
       a
       parser
       class
       is
       imple-mented. implemented.
       mented.

       Tcl
              Parser
              Class

       The
       pure-Tcl pureTcl
       Tcl
       parser
       class
       requires
       no
       com-pi compi
pi-la pila
la-tion lation
       tion
       -it tionit
       it
       is
       a
       col-lec collec
lec-tion lection
       tion
       of
       Tcl
       scripts.
       This
       parser
       imple-men implemen
men-ta menta
ta-tion tation
       tion
       is
       non-val nonval
val-i vali
i-dat idat
dat-ing, dating,
       ing,
       ie.
       it
       can
       only
       check
       well-formed wellformed
formed-ness formedness
       ness
       in
       a
       doc-u docu
u-ment. ument.
       ment.
       How-ever, However,
       ever,
       by
       enabling
       the
       -val-i -vali
i-date idate
       date
       option
       it
       will
       read
       the
       doc-u docu
u-ment's ument's
       ment's
       DTD
       and
       resolve
       exter-nal external
       nal
       enti-ties. entities.
       ties.


       This
       parser
       imple-men implemen
men-ta menta
ta-tion tation
       tion
       aims
       to
       imple-ment implement
       ment
       XML
       v1.0
       and
       sup-ports supports
       ports
       XML
       Names-paces. Namespaces.
       paces.


       Gen-er Gener
er-ally erally
       ally
       the
       parser
       pro-duces produces
       duces
       XML
       Infoset
       infor-ma informa
ma-tion mation
       tion
       items.
       That
       is,
       it
       gives
       the
       appli-ca applica
ca-tion cation
       tion
       a
       slightly
       higher-level higherlevel
       level
       view
       than
       the
       raw
       XML
       syn-tax. syntax.
       tax.
       For
       exam-ple, example,
       ple,
       it
       does
       not
       report
       CDATA
       Sec-tions. Sections.
       tions.



       Expat
              Parser
              Class

       This
       sec-tion section
       tion
       will
       dis-cuss discuss
       cuss
       the
       Expat
       parser
       class.




SEE
       ALSO

       TclDOM,
       a
       Tcl
       inter-face interface
       face
       for
       the
       W3C
       Doc-u Docu
u-ment ument
       ment
       Object
       Model.


KEY-WORDS KEYWORDS
       WORDS

Tcl Built-In Commands                                Tcl                                           TclXML(n)

Сообщение о проблемах

Способ сообщить о проблеме с этой страницей руководства зависит от типа проблемы:

Ошибки содержания
Ошибки отчета в содержании этой документации к проекту Tcl.
Отчеты об ошибках
Сообщите об ошибках в функциональности описанного инструмента или API к Apple через Генератор отчетов Ошибки и к проекту Tcl через их страницу создания отчетов ошибки.
Форматирование проблем
Отчет, форматирующий ошибки в интерактивной версии этих страниц со ссылками на отзыв ниже.