I know this may be a basic question, but I've tried every possible option I can think of. Simply put, all I'm trying to do, is add a "toXML()" method to a class, which converts my data into an Element which is returned to the calling object:
 
public class headache{
    public Element toXML(){
        .....
        return Element;
    }
}
 
 
    DocumentImpl doc = new DocumentImpl();
    Element root = doc.createElement("root");
 
    headache h = new headache();
 
    Element e = headache.toXML();
 
    root.appendChild(e);
 
Running this code I get:
Context log: path="" Error in qResults service() : org/w3c/dom/DOMException
 java.lang.InstantiationError: org/w3c/dom/DOMException
 
(Mind you, there is no such thing as a java.lang.InstantiationError, but there is a java.lang.InstantiationException)
 
I've tried setting up a cloneNode(node,true) at the "headache" class side as well as on the calling class side:
 
    public class headache{
        public Node toXML(){
            .....
            return Element.cloneNode(true);
        }
    }
 
    DocumentImpl doc = new DocumentImpl();
    Element root = doc.createElement("root");
 
    headache h = new headache();
 
    Element e = headache.toXML();
 
    root.appendChild(e);
 
This returns the same. If I try to use importNode(node,true) on the calling class side:
 
rott.appendChild(doc.importNode(headache.toXML(),true));
 
I get:
 
Context log: path="" Error in qResults service() : null
 java.lang.NoSuchMethodError
 
 at org.apache.xerces.dom.DocumentImpl.importNode(DocumentImpl.java:888)
 
I'm using Xerces 1.4.0 and JDK1.3. The code is running in servlets.
 
Cheers,
Anthony
 
 

Reply via email to