[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Simple approaches to XML implementation

  • From: Ingo Macherius <Ingo.Macherius@t...>
  • To: Peter@u...
  • Date: Sat, 1 Mar 1997 03:16:48 +0100 (MET)

simple xml db implementation
> 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@t... 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@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.