Simple approaches to XML implementation

Ingo Macherius Ingo.Macherius at
Sat Mar 1 02:16:59 GMT 1997

> Most documents will then need some sort of processing.  There are two
> main strategies:
> 	- event stream mode.
> 	- parse tree

I have made up a perl5 module which models a very simple forest-like strukture,
that holds Perl5 objects. The objects are created by reading nsgmls' ESIS
and putting anything between certain named tags into a hash, which
basically is the object content. The objects can be inserted as a root or into
another object, which yields a forest-like structure.
The tree-relations between objects are stored outside in a libdbm database,
one per tree. It holds three tables,	
- id -> hashed data
- id -> id of father object, or NULL
- id -> ids of all sons
Obviously any object must have a method giving a unique id within the forest.
I think this may be called a poor-mans-grove :) I made up a simple API:

	INSERT INTO DB ( when opened MODE 'write' )

        $db->insert_as_root ( $root );
        $db->insert         ( $child, '' );
        $db->update         ( $the_resource );


        $resource =  $db->fetch  ( '' );
        $father   =  $db->father ( '' );
        @sons     =  $db->sons   ( '' );
        @roots    =  $db->roots;

	       DERIVED FUNCTIONS (recursing all nodes below given @ids)
        @sons     =  $db->all_container_sons ( @ids );
        @sons     =  $db->all_leaf_sons ( @ids );
        @sons     =  $db->all_sons ( @ids );
        @fathers  =  $db->all_fathers ( @ids );

       DESTROY DB CONTENT ( when opened MODE 'write' )

I found this sufficient to solve small problems for which ESIS is not enough
and a grove is overkill. I must admit, albeit I read most of ISO 10179, I
really didn`t get the details. But what I found valuable is the choice 
between navigating (father/son) and id-based lookups (fetch).

Snail : Ingo Macherius // L'Aigler Platz 4 // D-38678 Clausthal-Zellerfeld
Mail  : Ingo.Macherius at WWW:
Information!=Knowledge!=Wisdom!=Truth!=Beauty!=Love!=Music==BEST (Frank Zappa)

xml-dev: A list for W3C XML Developers
Archived as:
To unsubscribe, send to majordomo at the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at

More information about the Xml-dev mailing list