[jdom-interest] DOMOutputter and other thoughts

Kevin Regan kevinr at valicert.com
Mon Jun 12 13:08:43 PDT 2000

With this example, it would mean that you would require
specific methods in the AbstractDOMAdaptor in order to
move the DocumentType over from the JDOM tree.  You
can call org.jdom.Document.getDocType(), but there would
be no way to move it to the new DOM tree.  It seems that
we are taking a more complicated root, rather than just
going with the standard DOM Level 2 DOMImplementation

If we go with DOMImplementation, the user simply does
something like:


org.w3c.dom.DOMImlementation DOMimpl =
  new org.apache.xerces.dom.DOMImplementationImpl();

org.jdom.output.DOMOutputter outputter = new DOMOutputter();
org.w3c.dom.Document = outputter.output( myJDOM, DOMImpl );


The only implementation dependant step is the first.
This first line of code can be replaced by creating the
DOMImplementation implementation of the user's choice.
It gives the user much flexibility over which implementation
he wants to use.

With your example, I'm still not sure how the document type
information can be copied over.  Maybe with something like:

org.jdom.adaptor.AbstractDOMAdaptor( DocType docType )

but doesn't this just implement the same thing
that DOMImplementation gives you?


p.s.  We both got "aberration" wrong in our previous emails... :-)

On Mon, 12 Jun 2000, Brett McLaughlin wrote:

> Kevin Regan wrote:
> > 
> > I am still not following you.  The DOMOutputter has this method:
> > 
> > void DOMOutputter.output(Document document, org.w3c.dom.Document
> > domTree)
> Yeah, I think this may need to actually become:
> public org.w3c.dom.Document output(org.jdom.Document doc);
> public org.w3c.dom.Document output(org.jdom.Document, String
> domAdapterClass);
> SO it returns a Document - maybe that's part of the confusion.
> SO inside:
>   org.w3c.dom.domDoc = XercesDOMAdapator.createDocument();
>   // go from here
>   domDoc.createElement...
>   domDoc.createXXX
> > 
> > the Xerces adaptor has:
> > 
> > org.w3c.dom.Document XercesDOMAdaptor.createDocument();
> > 
> > I don't see the connection.  The user wants to call
> > DOMOutputter.output(), but the above interface does
> > not cut it.  You say to "use an adaptor", but I don't
> > see how that is possible.
> > 
> > In DOM Level 2, the DocumentType and DOMImplementation are
> > in the standard DOM interface.  I'm not sure why you consider
> > these aberations. They aren't Xerces specific, the are common
> > to all DOM Level 2 implementation, correct?
> They aren't aberrations - I said the means to create a DOcumentType
> (which doesn't exist in standard DOM-land) is an aberration. Most DOM
> constructs allow creation through createXXX in the Document interface.
> The point is that they are even less familiar constructs than the rest
> of DOM, so we don't want users to have to know about them.
> -Brett

More information about the jdom-interest mailing list