- Timestamp:
- 2010-12-14T17:15:30+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java
r23405 r23489 55 55 56 56 String coll = (String)params.get(GSParams.COLLECTION); //SYSTEM_CLUSTER); 57 //String subaction = (String)params.get(GSParams.SUBACTION); 57 58 String service = (String)params.get(GSParams.SERVICE); 58 59 String classifier = (String)params.get("cl"); … … 60 61 61 62 logger.error("Collection="+coll); 63 logger.error("Subaction="+subaction); 62 64 logger.error("Service="+service); 63 65 logger.error("Classifier="+classifier); … … 72 74 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT_STRING, to, lang, uid); 73 75 74 request.setAttribute("service", service); 75 if(classifier != null) 76 request.setAttribute("classifier", classifier); 76 mr_request.setAttribute("service", service); 77 mr_request.setAttribute("subaction", subaction); 78 //if(classifier != null) 79 mr_request.setAttribute("classifier", classifier); 77 80 78 81 mr_request_message.appendChild(mr_request); … … 98 101 InputSource is = new InputSource( new StringReader( input ) ); 99 102 Document d = (Document) builder.parse( is ); 100 // Element e = d.getDocumentElement();101 // Node d2 = this.doc.importNode(e,true);103 //Node n1 = d.getFirstChild(); 104 //Document d2 = (Document) this.doc.importNode(e, true); 102 105 103 //Document format_doc = this.converter.newDOM(); 104 //doc.appendChild(d2); 105 106 //File interface_config_file = new File(GSFile.interfaceConfigFile(GSFile.interfaceHome(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.INTERFACE_NAME)))); 107 //if (!interface_config_file.exists()) { 108 // logger.error(" interface config file: "+interface_config_file.getPath()+" not found!"); 109 //} 110 //Document config_doc = this.converter.getDOM(interface_config_file, "utf-8"); 111 //if (config_doc == null) { 112 // logger.error(" could not parse interface config file: "+interface_config_file.getPath()); 113 //} 114 115 //Element config_elem = config_doc.getDocumentElement(); 116 //String base_interface = config_elem.getAttribute("baseInterface"); 117 106 //Element format_statement = this.doc.importNode(d, true); 118 107 119 108 // Call XSLT to transform document to xml format string 120 109 XMLTransformer transformer = new XMLTransformer(); 121 //String stylesheet = GSFile.stylesheetFile(GlobalProperties.getGSDL3Home(), (String)this.config_params.get(GSConstants.SITE_NAME), coll, (String)this.config_params.get(GSConstants.INTERFACE_NAME), "oran", "FormatAction"); 122 //logger.error(stylesheet); 110 // HOW DO I DO THIS PROPERLY? 123 111 Document style_doc = this.converter.getDOM(new File("/home/sam/greenstone3/web/interfaces/oran/transform/formatString.xsl"), "UTF-8"); 124 112 … … 127 115 128 116 // not sure what to do here - some code from Transforming Receptionist 129 String transformed = transformer.transformToString(style_doc, d); 130 //Node transformed = transformer.transform(style_doc, d); 131 117 //String transformed = transformer.transformToString(style_doc, d); 118 logger.error("About to transform"); 119 Node transformed = (Node) transformer.transform(style_doc, d); // Failing org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. ; SystemID: file:///home/sam/greenstone3/packages/tomcat/bin/dummy.xsl 120 121 logger.error("Transform successful?"); 122 123 if(transformed==null) // not null 124 logger.error("TRANSFORMED IS NULL"); 125 126 logger.error("begin import"); 127 Node imported = this.doc.importNode(transformed, true); // There was an exception org.w3c.dom.DOMException: NOT_SUPPORTED_ERR: The implementation does not support the requested type of object or operation. 128 logger.error("finished import"); 129 130 String format_string2 = GSXML.xmlNodeToString(imported); // null pointer exception occuring here 131 logger.error("format string="+format_string2); 132 132 133 Element format = this.doc.createElement(GSXML.FORMAT_STRING_ELEM); 133 GSXML.setNodeText(format, transformed);134 //format.appendChild(this.doc.createTextNode(transformed));134 //GSXML.setNodeText(format, transformed); 135 format.appendChild(transformed); 135 136 //format.setNodeValue(transformed); 136 137 mr_request.appendChild(format);
Note:
See TracChangeset
for help on using the changeset viewer.