[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: extractDOM: ClassCastException



Michael Keuchen wrote:
> 
> Hi,
> here's my next problem.
...
I've found the two bugs.

The method in org.ozoneDB.xml.util.XMLContainer

>    public Document extractDOM( Document _domFactory ) throws Exception {
>         return (Document) extractDOM( _domFactory, (NodeList)null, null,
> -1 );
>     }

has to be changed to 

>    public Document extractDOM( Document _domFactory ) throws Exception {
>         return (Document) extractDOM( _domFactory, (Node)null, null, -1
> );
>     }
> 


In org.ozoneDB.xml.util.SAXChunkConsumer.startDocument(),
the startNode has to be added to the resultNodeList. This is not done
yet.
I changed the lower half of the method to:

        if (this.startNode.hasChildNodes()) {
            throw new RuntimeException("The given DOM document must not
have children if a whole document shall be converted!");
        } 

        if (this.processLevel == 0)
            this.resultNodeList.addNode(this.startNode); // CHANGE

        this.currentNode = this.startNode;
        this.processLevel++;
    } 

and it seems to work.

Michael Keuchen