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

Content roles in XML

  • From: Jim Amsden <jamsden@u...>
  • To: <xml-dev@i...>
  • Date: Thu, 22 Jan 1998 13:50:50 -0500

javabeans.dtd
I'm very new to XML, and in developing a DTD for JAR files, JavaBeans, and
Rational Rose petal files, I experienced a recurring problem. The EventSet
element of the JavaBeans DTD is exemplary. Here's a fragment of the JavaBeans
DTD I came up with:

<!ELEMENT EventSet (Annotation*, Method, Method, Method+)>
<!ATTLIST EventSet
  %FeatureDescriptor;

  listenerType CDATA #REQUIRED
  isInDefaultEventSet (true | false) "false"
  isUnicast (true | false) "false"
>

The content of an Event set includes two required methods, and a collection of
other methods. In the DTD, there's no way that I know of to indicate the roles
these methods play in the EventSet. I would like to say something like:

<!ELEMENT EventSet (Annotation*, addListenerMethod, removeListenerMethod,
eventMethod+)>
<!ATTLIST EventSet
  %FeatureDescriptor;

  listenerType CDATA #REQUIRED
  isInDefaultEventSet (true | false) "false"
  isUnicast (true | false) "false"
>

where addListenerMethod, removeListenerMethod, and eventMethod are all Method
elements. This more clearly describes the content of an EventSet and avoids
using positioning only to capture the meaning of element content. I could use
parameter entities to achieve this effect as in:

<!ENTITY % addListenerMethod "Method">
<!ENTITY % removeListenerMethod "Method">
<!ENTITY % eventMethod "Method">

<!ELEMENT EventSet (Annotation*, %addListenerMethod;, %removeListenerMethod;,
%eventMethod;+)>
<!ATTLIST EventSet
  %FeatureDescriptor;

  listenerType CDATA #REQUIRED
  isInDefaultEventSet (true | false) "false"
  isUnicast (true | false) "false"
>

Is this reasonable? Good XML DTD style? Not too much of a runtime overhead? A
common practice? Note that this probably wouldn't help with the parsed XML as
there would be a Method element for each method. You couldn't ask an EntitySet
element for it's addListenerMethod content like you could ask it for it's
isUnicast attribute. You'd have to know to get the first Method in the content.
Of course an extensible parser with factory methods for constructing parse tree
nodes could hide the position dependence and provide more meaningful accessors.

I guess what I'm looking for is a way to capture (using UML terms) the
association roles between the EventSet Class and the Method Class. There are 3
associations between these two classes, and I need a way to distinguish them.

Anyone have any other ideas? Has anyone else experienced this situation?





xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto: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.