Ignore:
Timestamp:
2008-08-08T13:23:59+12:00 (16 years ago)
Author:
davidb
Message:

Changed 'Element process(Element)' in ModuleInterface to 'Node process(Node)'. After some deliberation is was decided this is a more useful (generic) layer of the DOM to pass information around in. Helps with the DocType problem when producing XSL Transformed pages, for example. When this was an Element, it would loose track of its DocType. Supporting method provided in XMLConverter 'Element nodeToElement(Node)' which checks a nodes docType and casts to Element if appropriate, or if a Document, typecasts to that and then extracts the top-level Element. With this fundamental change in ModuleInterface, around 20 files needed to be updated (Actions, Services, etc) that build on top of 'process()' to reflect this change, and use nodeToElement where necessary.

Location:
greenstone3/trunk/src/java/org/greenstone/gsdl3/comms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/comms/Communicator.java

    r9874 r16688  
    6161
    6262    public String process(String xml_in) {
    63     Element e = converter_.getDOM(xml_in).getDocumentElement();
    64     Node result = process(e);
     63    Node n = converter_.getDOM(xml_in);
     64    Node result = process(n);
    6565    return converter_.getString(result);   
    6666    }
    6767
    68     abstract public Element process(Element xml_in);
     68    abstract public Node process(Node xml_in_node);
    6969}
  • greenstone3/trunk/src/java/org/greenstone/gsdl3/comms/SOAPCommunicator.java

    r13270 r16688  
    5656    private Call call_ = null;
    5757
    58   /** The no-args constructor */
    59     public SOAPCommunicator() {
    60    
     58    protected XMLConverter converter_ = null;
     59
     60    /** The no-args constructor */
     61    public SOAPCommunicator() {
     62    converter_ = new XMLConverter();
    6163    }
    6264       
     
    9496    }
    9597
    96     public Element process(Element message) {
     98    public Node process(Node message_node) {
    9799   
     100    Element message = converter_.nodeToElement(message_node);
     101
    98102    NodeList requests = message.getElementsByTagName(GSXML.REQUEST_ELEM);
    99103    if (requests.getLength()==0) {
     
    159163    message = "<message><request type=\"describe\" to=\"\" lang=\"en\"/></message>";
    160164    Element request_elem = converter.getDOM(message).getDocumentElement();
    161     Element response = comm.process(request_elem);
     165    Node response = comm.process(request_elem);
    162166   
    163167    logger.error("response was "+converter.getPrettyString(response));
Note: See TracChangeset for help on using the changeset viewer.