Gentee Programming Language > Documentation > Libraries Download documentation

XML file processing

This library is used for XML file processing and XML tree building. Neither a multibyte-character set nor a document type description <!DOCTYPE .....> are handled in the current version. For using this library, it is required to specify the file xml.ge (from Lib subfolder) with include command.
Variables of either the xml and the xmlitem type (an XML tree item) are used for processing XML documents.
An XML tree item can be of two types: a text item and a tag item. There are several types of tag items:

A tag item may contain attributes.

The sequence of operations for processing an XML document:
  • Operations
  • Methods
  • Methods of XML tree items

    Operations

    Operations defined for the variable of xml type are listed below. The second column contains possible statements where typename is a variable or an expression of the specified type.
     
    OperationSyntaxReturn typeComments
    foreachThe option of using in the foreach statement. Defining an optional variable of the xmltags type is required. The foreach statement is used for variables of the xmlitem type and goes through all child tag items of the current tag.

    xmltags xtags
    ...
    foreach xmlitem cur, curtag.tags( xtags )
    {
       ...
    }

    Methods

    xml.addentityAdd an entity description
    xml.getrootGet the root item of the XML document tree
    xml.procfileProcess an XML file
    xml.procstrProcess an XML string

    Methods of XML tree items

    xmlitem.chtagGet a tag item with the help of a "path"
    xmlitem.findtagSearch for a tag item by the name
    xmlitem.getattribGet a tag attribute
    xmlitem.getchildGet the child item
    xmlitem.getchildtagGet the child tag item
    xmlitem.getchildtextGet the child text item
    xmlitem.getnextGet the next item
    xmlitem.getnexttagGet the next tag item
    xmlitem.getnexttextGet the next text item
    xmlitem.getparentGet the parent item
    xmlitem.gettextGet a text of the current item
    xmlitem.isemptytagDetermine if the item is a tag item that contains no child items
    xmlitem.ispitagDetermine if the item is a tag of processing instruction
    xmlitem.istagDetermine if the item is a tag item
    xmlitem.istextDetermine if the item is a text item


     Copyright © 2004-2006 Gentee Inc. All rights reserved.