[jdom-interest] DOMBuilder

Bradley S. Huffman hip at cs.okstate.edu
Mon May 3 08:24:52 PDT 2004


phil at triloggroup.com writes:

> <html><body>
> <p>Can you please make this method protected instead of private:<br>
>     private void buildTree(Node node,<br>
>                            Document doc,<br>
>                            Element current,<br>
>                            boolean atRoot)<br>
> <br>
> This will allow us some computation while converting a DOM.<br>

I'd prefer a better extension mechinism, and for it to be consistent
throughout the API.  Something like XOM's NodeFactory, except I think
I'd prefer the following methods in SAXHandler (explicitly pushing/poping
the element parent rather than relying on if, when, and whether null is
return).

    /* node to be added, returns list of nodes to be added to 
       current element. Default return parameter node untouched */
    protected List<Content> addContent(Content node);

    /* return current element parent being built */
    protected Element getCurrentElement();

    /* push a new current Element parent */
    protected void pushElement(Element newParent);

    /* pop the current parent Element */
    protected Element popElement();

Then have various classes that build a jdom tree all take a instance of
SAXHandler as a parameter. But this is something that would be a extension to
the current API and could be done after 1.0 release.

Brad



More information about the jdom-interest mailing list