[jdom-interest] Protected methods to make private

Bradley S. Huffman hip at csa.cs.okstate.edu
Tue Jun 17 14:30:53 PDT 2003


Is there some reason we cann't get rid of JDOMResult.FragmentHandler and
put the methods getResult and clearResult in SAXHandler?

Brad

Jason Hunter writes:

> That's a beautiful solution, and I just checked it in.
> 
> -jh-
> 
> Laurent Bihanic wrote:
> >> SAXHandler:
> >>   atRoot
> >>
> >> I see JDOMResult.FragmentHandler uses this.  That's an odd property to 
> >> expose.  Could this be done another way?  Laurent?
> > 
> > 
> > Sure, this could be removed if SAXHandler provided a protected 
> > pushElement() method.
> > As JDOMResult may receive a node list and not a document, it needs to 
> > add a dummy root element to the being-built document before the parse 
> > begins. To do that, I simply pasted some code from startElement.
> > 
> > For example, in SAXHandler:
> > 
> > protected void pushElement(Element element) {
> >     if (atRoot) {
> >         document.setRootElement(element);
> >         atRoot = false;
> >     } else {
> >         getCurrentElement().addContent(element);
> >     }
> >     currentElement = element;
> > }
> > 
> > Then JDOMResult.FragmentHandler constructor could be changed to:
> >     public FragmentHandler(JDOMFactory factory) {
> >       super(factory);
> > 
> >       // Add a dummy root element to the being-built document as XSL
> >       // transformation can output node lists instead of well-formed
> >       // documents.
> >       this.pushElement(dummyRoot);
> >     }
> > 
> > Laurent
> > 
> > 
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost
> .com



More information about the jdom-interest mailing list