Changeset 16756


Ignore:
Timestamp:
08/13/08 14:24:59 (13 years ago)
Author:
ak19
Message:

Since greenstone3 core ModuleInterface.process() now takes a Node and RETURNS a Node, have copied the XMLConverter.nodeToElement() into here to convert the Node back into the Element version of the response.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/resources/java/SOAPServer.java.in

    r13897 r16756  
    2525import org.greenstone.gsdl3.util.GSXML;
    2626import org.w3c.dom.Element;
     27import org.w3c.dom.Node;
     28import org.w3c.dom.Document;
    2729import java.io.File;
    2830
     
    7476        }
    7577        Element new_req = GSXML.duplicateWithNewName(req.getOwnerDocument(), req, tag_name, true);
    76         Element r = mr.process(new_req);
     78        Element r = nodeToElement(mr.process(new_req));
    7779        // add the namespace back on
    7880        //Element new_res = r;
     
    8385    }
    8486    return result;
    85     }   
     87    }
     88
     89    protected Element nodeToElement(Node node)
     90    {
     91    short nodeType = node.getNodeType();
     92
     93    if (nodeType == Node.DOCUMENT_NODE) {
     94        Document docNode = (Document)node;
     95        return docNode.getDocumentElement() ;
     96    }
     97    else if (nodeType == Node.ELEMENT_NODE) {
     98        return (Element)node;
     99    }
     100    else {
     101        System.err.println("Expecting Document or Element node type but got " + node.getNodeName());
     102        System.err.println("Returning null");
     103        return null;
     104    }
     105    }
    86106}
    87107
Note: See TracChangeset for help on using the changeset viewer.