OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: Simple approaches to XML implementation

[ Lists Home | Date Index | Thread Index ]
  • From: Ingo Macherius <Ingo.Macherius@tu-clausthal.de>
  • To: Peter@ursus.demon.co.uk
  • Date: Sat, 1 Mar 1997 03:16:48 +0100 (MET)

> 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, 'root.id' );
        $db->update         ( $the_resource );


       QUERY THE DB
	       BASIC FUNCTIONS


        $resource =  $db->fetch  ( 'root.id' );
        $father   =  $db->father ( 'child.id' );
        @sons     =  $db->sons   ( 'root.id' );
        @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' )
        $db->reset;

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).

	++im
-- 
Snail : Ingo Macherius // L'Aigler Platz 4 // D-38678 Clausthal-Zellerfeld
Mail  : Ingo.Macherius@tu-clausthal.de WWW: http://www.tu-clausthal.de/~inim/
Information!=Knowledge!=Wisdom!=Truth!=Beauty!=Love!=Music==BEST (Frank Zappa)

xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@ic.ac.uk)





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS