[esb-java-dev] svn commit r2105 - in trunk/esb/java/modules/distribution/src/main/www/extensions/core/js: . mediators

svn at wso2.org svn at wso2.org
Sat Apr 28 00:32:26 PDT 2007


Author: indika
Date: Sat Apr 28 00:32:21 2007
New Revision: 2105

Modified:
   trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js
   trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/send_mediator.js
Log:
add method to serialize XML to String for IE 

Modified: trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js	(original)
+++ trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/commons.js	Sat Apr 28 00:32:21 2007
@@ -88,7 +88,7 @@
 ///////////////////////// YUI abstractions /////////////////////////////////////////////////////
 
 function yuieditorpanel(paneltitle, panelbody, statusbartext) {
-    
+
     var divcontrol = document.getElementById("divOverPanel");
     divcontrol.innerHTML = "";
 
@@ -106,4 +106,45 @@
     esbpanel.render();
     divcontrol.style.display = "inline";
     esbpanel.show();
-}
\ No newline at end of file
+}
+function transformXMLToString(xmlDoc, xslDocURL, objDiv) {
+    if (browsername.indexOf(NETSCAPE_BROWSER_NAME) != -1) {
+        processXML(xmlDoc, xslDocURL, objDiv)  ;
+        return new XMLSerializer().serializeToString(objDiv);         
+    }
+    else if (browsername.indexOf(IE_BROWSER_NAME) != -1) {
+        var fullPath = URL + "/extensions/core/xslt/"+xslDocURL;
+        return transformXMLIE(xmlDoc, fullPath, objDiv);
+    }
+}
+function transformXMLIE(xmlDoc, xslDocURL, objDiv, paramArray)
+{
+    // declare the local variables
+    var xslDoc, docProcessor, docCache, DocRequest, docFragment;
+    // try the following
+    try
+    {
+        // instantiate and load the xsl document
+        xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
+        xslDoc.async = false;
+        xslDoc.load(xslDocURL);
+        // prepare the xsl document for transformation
+        docCache = new ActiveXObject("MSXML2.XSLTemplate");
+        docCache.stylesheet = xslDoc;
+        // instantiate the document processor and submit the xml document
+        docProcessor = docCache.createProcessor();
+        docProcessor.input = xmlDoc;
+        // add parameters to the xsl document
+        if (paramArray) {
+            docProcessor.addParameter("topLevelHeading", paramArray[0], "");
+        }
+        // process the documents into html and submit to the passed div to the HMTL page
+        docProcessor.transform();
+        // divID.innerHTML = docProcessor.output;
+        return "<div>" + docProcessor.output + "</div>";
+    }
+    // catch any errors from the above code
+    catch(e) {
+        alert("Encounterd an error  : " + e);
+    }
+}

Modified: trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/send_mediator.js
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/send_mediator.js	(original)
+++ trunk/esb/java/modules/distribution/src/main/www/extensions/core/js/mediators/send_mediator.js	Sat Apr 28 00:32:21 2007
@@ -25,6 +25,9 @@
 
 initedit["send"] = function initsendedit(mediator) {
     sendmediator = mediator;
+    currentepobj= null;
+    previous_ep_value = null;
+    sendmediator_c_pos = null;
     var body_xml = '<ns1:getAvailabelEndpoints xmlns:ns1="http://org.apache.synapse/xsd">' +
                    '</ns1:getAvailabelEndpoints>';
     var callURL = serverURL + "/" + PROXY_ADMIN + "/" ;
@@ -112,6 +115,7 @@
 function deleteSendMediatorEndponit(position) {
     sendmediator_c_pos = position;
     currentepobj = null;
+   
     if (sendmediator_c_pos != null && sendmediator_c_pos != undefined) {
         var mediator = getnestedmediator(internalmodel.sequence, sendmediator_c_pos);
         if (mediator.childNodes.length > 0) {




More information about the Esb-java-dev mailing list