r1757 - in branches/bxe_2_0: . js mozile relaxng

[email protected] Fri, 14 Sep 2007 10:39:36 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Fri Sep 14 10:39:36 2007
New Revision: 1757

Log:
fix for BXEB-4 and BXEB-37
better error messages


Modified:
   branches/bxe_2_0/bxeLoader.js
   branches/bxe_2_0/js/bxeXMLDocument.js
   branches/bxe_2_0/mozile/mozilekb.js
   branches/bxe_2_0/relaxng/DocumentVDOM.js

Modified: branches/bxe_2_0/bxeLoader.js
==============================================================================
--- branches/bxe_2_0/bxeLoader.js	(original)
+++ branches/bxe_2_0/bxeLoader.js	Fri Sep 14 10:39:36 2007
@@ -75,7 +75,9 @@
 var startTimer = new Date();
 
 function bxe_dump(text) {
-	//console.log(text);
+	if (typeof console != 'undefined' && console.log) {
+		console.log(text);
+	}
 }
 	
 
@@ -122,7 +124,7 @@
 				} else {
 					scr.onload = corescript_loaded;
 				}
-				scr.setAttribute("src", src);
+				scr.setAttribute("src", src); // + "?d=" + new Date());
 				scr.setAttribute("language","JavaScript");
 				head.appendChild(scr);
 			}
@@ -217,20 +219,15 @@
 	var td = new mozileTransportDriver(bxe_config.xmlfile_method);
 	function callback (e) {
 		if (e.isError) {
-			bxe_alert("Error loading XML document.\nSee console.log for details.");
-			if (console.log) {
-				console.log( e.statusText);
-			}
-			
+			bxe_alert("Error loading XML document.\nSee console for details.");
+			bxe_dump(e.statusText);
 			return false;
 		}
 		var xmldoc =  e.document;
 		if (!xmldoc.documentElement) {
-			bxe_alert("Something went wrong during loading the XML document.\nSee console.log for details.");
-			if (console.log) {
-				console.log( "XMLDoc:" + xmldoc.saveXML());
-				console.log( e);
-			}
+			bxe_alert("Something went wrong during loading the XML document.\nSee console for details.");
+			bxe_dump("XMLDoc:" + xmldoc.saveXML());
+			bxe_dump( e);
 			return false;
 		}
 		
@@ -363,7 +360,7 @@
 		} else {
 			for (var i = 0; i < bxe_plugin_scripts.length; i++) {
 				var scr = document.createElementNS("http://www.w3.org/1999/xhtml","script");
-				scr.setAttribute("src", bxe_plugin_scripts[i]);
+				scr.setAttribute("src", bxe_plugin_scripts[i]); //+ "?d=" + new Date());
 				scr.setAttribute("language","JavaScript");
 				scr.onload = bxe_plugin_script_loaded;
 				head.appendChild(scr);
@@ -466,7 +463,7 @@
 			var src = mozile_root_dir + bxe_config.scriptfiles[i];
 		}
 		scr.onload = script_loaded;
-		scr.setAttribute("src", src);
+		scr.setAttribute("src", src);//+ "?d="+new Date());
 		scr.setAttribute("language","JavaScript");
 		head.appendChild(scr);
 	}

Modified: branches/bxe_2_0/js/bxeXMLDocument.js
==============================================================================
--- branches/bxe_2_0/js/bxeXMLDocument.js	(original)
+++ branches/bxe_2_0/js/bxeXMLDocument.js	Fri Sep 14 10:39:36 2007
@@ -136,14 +136,13 @@
 		xsldoc = e.currentTarget;
 		
 		if (!xsldoc.documentElement) {
-			bxe_alert("Something went wrong during loading the XSLT document.\nSee console.log for details.");
-			if (console.log) {
-				console.log( "XSLDoc: " + xsldoc.saveXML());
-				console.log( e);
-			}
+			bxe_alert("Something went wrong during loading the XSLT document.\nSee console for details.");
+			bxe_dump( "XSLDoc: " + xsldoc.saveXML());
+			bxe_dump( e);
 			return false;
 		}
 		var xsltransformdoc = document.implementation.createDocument("", "", null);
+		bxe_about_box.addText("Loading transform XSLT ...");
 		xsltransformdoc.addEventListener("load", this.onload_xsltransform, false);
 		xsltransformdoc.xsldoc = xsldoc;
 		xsltransformdoc.load(mozile_root_dir + "xsl/transformxsl.xsl");
@@ -159,10 +158,15 @@
 		} else {
 			xsltransformdoc = e.currentTarget;
 		}
-		processor.importStylesheet(xsltransformdoc);
-		
+		if (!xsltransformdoc.documentElement) {
+			bxe_alert("Something went wrong during loading the Transform-XSLT document.\n Try reloading or see console for details.");
+			bxe_dump( "Transform XSLDoc: " + xsltransformdoc.saveXML());
+			bxe_dump( e);
+			return false;
+		}
 		
 		try {
+			processor.importStylesheet(xsltransformdoc);
 			var newDocument = processor.transformToDocument(xsltransformdoc.xsldoc);
 			// we have to reparse the transformed document, otherwise
 			// mozilla has a problem with xsl matchers with namespaces :(
@@ -179,6 +183,7 @@
 				alert ( f + "\n\n "+bxe_i18n.getText("xsltransformdoc.xsldoc is : ") + xsltransformdoc.xsldoc);
 			} else {
 				bxe_config.xmldoc._originalXslTransformCounter++;
+				bxe_about_box.addText("bxe_config.xmldoc._originalXslTransformCounter");
 				window.setTimeout("bxe_config.xmldoc.onload_xsltransform(bxe_config.xmldoc._originalXslTransformEvent)",300);
 			}
 			return;
@@ -196,14 +201,9 @@
 			//bxe_dump(newDocument.saveXML(newDocument));
 			var widg = mozilla.getWidgetModalBox("Load Error");
 			widg.addText("Something went wrong during importing the XSLT document");
-			widg.addText("See console.log for details.");
+			widg.addText("See console for details.");
 			widg.show((window.innerWidth- 500)/2,50, "fixed");
-			if (console.log) {
-				console.log(bxe_catch_alert_message(e) + "\n" + newDocument.saveXML(newDocument));
-			}
-				
-			
-			
+			bxe_dump(bxe_catch_alert_message(e) + "\n" + newDocument.saveXML(newDocument));
 			return;
 		}
 		bxe_config.processor = processor;

Modified: branches/bxe_2_0/mozile/mozilekb.js
==============================================================================
--- branches/bxe_2_0/mozile/mozilekb.js	(original)
+++ branches/bxe_2_0/mozile/mozilekb.js	Fri Sep 14 10:39:36 2007
@@ -654,8 +654,6 @@
 					bxe_checkEmpty(_par.XMLNode,makeDefault);
 				}
 			} catch(e) {
-				//console.log(e);
-				
 			}
 			
 		}

Modified: branches/bxe_2_0/relaxng/DocumentVDOM.js
==============================================================================
--- branches/bxe_2_0/relaxng/DocumentVDOM.js	(original)
+++ branches/bxe_2_0/relaxng/DocumentVDOM.js	Fri Sep 14 10:39:36 2007
@@ -28,10 +28,8 @@
 	//if it's an XMLSchema File
 	if (!this.xmldoc.documentElement) {
 		
-		bxe_alert("Something went wrong during importing the Validation/RelaxNG document\n.See console.log for details.");
-		if (console.log) {
-			console.log("RNG Doc:" + this.xmldoc.saveXML());
-		}
+		bxe_alert("Something went wrong during importing the Validation/RelaxNG document\n.See console for details.");
+		bxe_dump("RNG Doc:" + this.xmldoc.saveXML());
 		return false;
 		
 		
@@ -45,10 +43,8 @@
 		this.xmldoc.documentElement.namespaceURI == "http://relaxng.org/ns/structure/1.0" ) {
 		this.parseRelaxNG();
 	} else {
-		bxe_alert("Validation/RelaxNG document is not valid.\n See console.log for details.");
-		if (console.log) {
-			console.log(this.xmldoc.saveXML(this.xmldoc));
-		}
+		bxe_alert("Validation/RelaxNG document is not valid.\n See console for details.");
+		bxe_dump(this.xmldoc.saveXML(this.xmldoc));
 		return false;
 	}
 	this.onparse(this);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs