SOX

Graham Moore graham.moore at dpsl.co.uk
Thu Oct 1 14:27:25 BST 1998




peter I agree that the mapping issue is of vital importance. In a similar 
way to the SUN stuff I've developed a domBuilder that can take an XML file 
which specifies the class mapping (example file below) , or can look in a 
given package for classes that match element names and an XML file / stream 
from which to build the structure.

I think there are two points to consider:

1) Possinbly we should be using XML to specify the binding.
2) Leaving scope in the biding spec to allow for the declaration of 
delegation structures.  Given that inheritance is a specialisation of 
delegation perhaps this should happen anyway. In the same way that arbitrary 
functional mapping is undesirable so is  the arbitrary construction of 
delegation structures.

The issue with using inheritance is that the mixin class must inherit from 
the elementNode / generic data object class used in the domBuilder. Using 
delegation and dynamic invocation this is not a problem.

consider

  delObject.tell(objectRef, "method", args);

which could be wrapped further

  system.tell(delObject, "tell", args); where are 0 is the method names and 
1 - n are the real args.

Internally each member of the delegation structure would have to be aware 
they were in one but this is generically handled by

public class delMemeber {
   private Object outerSelf;

   public void doit(){
     String att val =  (String)system.tell(outerSelf, "getAttribute", args);
   }

}

So the delmember would not have to subclass any elementNode object, just 
implement the delMember interface.

public  interface delegationMember {
   private Object outerSelf;
   void setOuterSelf(Object os);
}

This means that domBuilder writers subscribe to acknowlege the contract of 
intialising the classes appropriately and class writers can easily write and 
bind objects.

This does require a bit of a mind set change for one thing there is no 
compile time error generation. But perhaps this is a price worth paying for 
a more dynamic, open and flexible system. It would be nice if java supported 
delelgation and dynamic invocation as part of the langauge; writing it on 
top seems a bit messy.

Example functional mixin file: This is very simplistic but illustrates what 
we could do. I haven't considered the delegation structure in any real 
depth.

<?xml version='1.0'?>
<mixins>
<mixinassoc elem="breakfast-menu" jclass="grove.menu"/>
<mixinassoc elem="food" jclass="grove.food"/>
</mixins>

What do people think?

graham.

gdm at dpsl.co.uk








xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list