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

RE: Xapi-J: an architectural detail

  • From: clloyd@g... (Chris Lloyd)
  • To: xml-dev@i...
  • Date: Tue, 05 Aug 1997 07:46:03 -0400

architectural detail
akirkpatrick wrote:
>I really like the combination of IContent and IContainer.
>The only question I have is how an element can query
>its context in an efficient way? For example, how can
>I find the previous element without referring to the parent
>container. Presumably then the parent would have to
>enumerate all its children to find the previous content
>to the element in question. Obviously a particular
>application can record the previous element in a variable
>but then you get to more complex contexts, like "what
>is the previous of my parent".
>
This is where the next step is needed. Tree Iterators can provide efficient
and well abstracted mechanisms for walking the XML tree. Everyone is still
stuck on the schema part of Xpia-j and that is fine. After that is done
then it's time to add classes specifically for navigation.

Keep the schema simple. Don't add members for the previous child, etc.. It
is unnecessary and complex to maintain.

Over the past 2 years, we have been developing an object database system
for SGML. We have gone through the same thought processes as are going on
with xapi-j right now. I think there are a few design considerations to
keep in mind if you want to use iterator classes with the xapi-j schema and
I think eventually you will.

The idea of inheriting from IContainer is a good one. Polymorphism is very
useful when it comes time to write navigation classes. A base class for all
objects in the tree is very important!! We'll call this INode.

It then becomes useful to break the type of nodes into 2 classes.
IContainer and IProperty. An IProperty is always a leaf node of the tree
and an IContainer is not. After that you add your concrete classes such as
IElement.

John Tigue wrote:

>These interfaces only express the methods for navigating a tree. A
>particular class of objects would need to have some more methods to be
>interesting. For example, the interface for an element is IElement. The
>full source follows:


>public interface IElement extends IContent, IContainer
>    {
>     public String getType();
>     public void setType( String aType );
>     public void addAttribute( String name, String value );
>     public void removeAttribute( String name );
>     public IAttribute getAttribute( String attributeName );
>     public java.util.Enumeration getAttributes();
>     }

In the above example the returned interface IAttribute would inherit from
IProperty because it is a leaf node.

A Tree Iterator would already now the structure of an element when it walks
over it an would know how to retrieve the attributes. When it walks on to
an attribute, it knows it's a leaf node because it inherits from IProperty.

Again I stress that every XML object in the tree should inherit from a
single base class even if the base class does not provide any common
interfaces to it's concrete classes. In this way, any XML object can be
passed via a base class reference(Whoops, I almost said pointer). It is
trivia to implement a fast, safe-casting mechanism that uses polymorphism
for casting.

This way, we can later add navigation classes that leverage the polymorphic
nature of the XML tree.

Chris Lloyd
POET Software








>Any thoughts?
>Alfie.
>
>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...)
>
>

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.