Hi everyone,
Here is an idea I had to try to reconcile the two side about the EJB1.1 XML
deployment descriptor.
First, let resume the two sides:
All elements DTD
------------------
The "all elements" side want a dtd where each everything in the XML document is
an element.
The main arguments for this is:
- Consistency
This approach requires an validate everything validator, wich will be written,
eventually, as a JavaBean.
Put some xml attributes DTD
-----------------------------
The "put some xml attributes" side want to specify attributes to qualify the
main elements (ex: 'reentrant').
The main argumkenrs are:
- Better DTD validation
- Can use any generic XML editor to produce a valid XML DD document
This approach require a DTD that specify the validation to produce a valid
document, and a validator that will validate more complex validation rules
(such as valid class names and stuff like that).
I think a compromise can be made that will allow for a strong DTD validation
with an approach that offer more consistency.
The general idea is to have an all elements approacyh, with the addition of
"value" attributes to provide the domain of value for specifying the value of
an element. If the value of an element is free-form text, then no attributes
will be specified, and a text-node will represent the value (as in the current
DTD).
For example, the current DTD specifies the <Reentrant> element like this:
<!ELEMENT reentrant (#PCDATA)>
Here is an example of how it will looks like in a xml document:
<entity>
<reentrant>False</reentrant>
</entity>
With the current proposition it will be specified like this:
<!ELEMENT reentrant EMPTY>
<!ATTLIST reentrant
value (True | False) "True"
>
Here is an example of how it will looks like in a xml document:
<entity>
<reentrant value="False"/>
</entity>
Note that values that are not multiline (like class name) should be specified
the same way.
<!ELEMENT ejb-class EMPTY>
<!ATTLIST ejb-class
value CDATA #required
>
By using this approach, we keep the consistency argument, everything is an
element.But we have the added value that we can specify a domain for each value
that requires one.
Also the code that read the document will be cleaner, with DOM it take less
steps to read a attribute value than a text-node.
Another thing to change would be to put all the element in a namespace
("ejb-dd" for example).
I hope this new idea will stimulate the discussion in a constructive way.
SeeU!
-----
Emmanuel Pirsch
Sun Certified Java Programmer
Unite for Java! - http://www.javalobby.org/
---
"The intuitive mind is a sacred gift and the rational mind is a faithful
servant. We have created a society that honors the servant and has forgotten
the gift."
- Albert Einstein.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".