Hello,

I think that real OO approach will be to add 

HTMLDocument extends Document

and keep plain Document class simple - without head and body. Actually,
there is Html class, should it be used as HTMLDocument?

At 09:58 14.12.99 -0600, you wrote:
>All-
>
>       In using ECS for XML, I currently have to do this:
>
><code>
>import org.apache.ecs.Document;
>import org.apache.ecs.html.Head;
>import org.apache.ecs.html.Body;
>import org.apache.ecs.xml.XML;
>import org.apache.ecs.xml.PI;
>
>public doXML() {
>       Document doc = new Document();
>       Head head = new Head();
>       // Add XML prolog
>
>       Body body = new Body();
>       // Add XML content
>
>       doc.setHead(head);
>       doc.setBody(body);
>
>       System.out.println(doc.toString());
>}
></code>
>
>This is a little annoying, because what I want to do is:
>
><code>
>import org.apache.ecs.Document;
>import org.apache.ecs.xml.XML;
>import org.apache.ecs.xml.PI;
>
>public doXML() {
>       Document doc = new Document();
>
>       XML prolog = /* Assign */;
>       doc.appendBody(prolog);
>       // Add more content
>}
></code>
>
>The problem is that by default, Document's constructor adds in a head,
>title, and body element.  So I can't append, I have to replace them with
>setHead() and setBody().  But this is not really good OO, because now I
>have to import two org.apache.ecs.html classes to do pure XML.  I
>personally think this is not good.  In addition, there is no notion of
>head, body, etc., in an XML Document.  So I propose:
>
>(1) Create XMLDocument (extends Document)
>(2)   Add constructor with no parameters that simply creates an empty
>XML document
>*     This allows appendHead, appendBody, whatever, no problem.  They
>will all just do an addElement().  Over time, we can remove these
>methods altogther, but for now are there for portability
>(3)   Add constructor with one parameter, version (float)
>(4)   Add constructor with two parameters, version and standalone
>(boolean)
>*     (3) and (4) create the first required XML Instruction (<?xml
>version="1.0" standalone="yes"?>)
>(5)   Add setVersion(version, standalone) that can also set this
>
>Yes, I know that the first line there is really a PI, but it isn't
>treated like one, and doing things this way is more true to the spirit
>of the spec.  At a later time, I will suggest some XSL and other
>adoptions for the prolog.
>
>Anyway, anyone object to this?  I can do it today probably.
>
>-Brett
>
>
>--
>------------------------------------------------------------
>To subscribe:        [EMAIL PROTECTED]
>To unsubscribe:      [EMAIL PROTECTED]
>Archives and Other:  <http://java.apache.org/main/mail.html>
>Problems?:           [EMAIL PROTECTED]


Zeljko Trogrlic
____________________________________________________________

@-solutions GmbH
Grillparzer Str. 14; D-81675 Muenchen
Tel.: 089/45 79 0-351; Fax.: 089/45 79 0-321 
Email: mailto:[EMAIL PROTECTED]  WWW: http://www.at-solutions.de 



--
------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to