xml-xmlbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darrell Teague" <darrell.tea...@cox.net>
Subject XML Object Example
Date Thu, 21 Aug 2003 18:39:25 GMT
(Company mail server having problems so if you had replied, please reply to
this address...)


As a follow-on to my previous message offering my services (if desired) for
the XML Beans project, I am attaching a sample set of classes that may
provide some ideas on how XML Beans might be manifested after schema
parsing.  That is, I assume certain properties like object (though not XML
tree element meta-data) immutability (after parsing an element from an
instance document) are desirable.

This particular XMLDate class is an instance of java.util.Date but with
decorations and adaptations to allow it to be created from or mutated into
XML.  Furthermore, it is a composite object that includes an immutable
content JDOM element (though any DOM-type model could be used).  The intent
here is to demonstrate how the object data itself is immutable (Bloch 2002)
but yet can be part of a node/element tree (possibly through the use of some
kind of common XMLElement interface that would allow independence from XML
API models like JDOM - though I like it).  The issue with using some models
(namely JDOM) directly is that, for performance reasons (chiefly), they
break the "is-a" rule for objects by relying on an inheritance model for
extension of the API.  In the attached MetaElement class (an instance of
which is a member of the XMLDate class), you will see a possible
implementation of how to utilize good libraries like JDOM without
compromising good o-o practices.

Anyway, I would be glad to help with the XML Beans project - just let me
know if you are interested.  Thanks.

Darrell Teague
757.478.8648 (m)

View raw message