r1408 - trunk/relaxng

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Thu Oct  6 19:10:17 2005
New Revision: 1408

Modified:
   trunk/relaxng/ElementVAL.js
   trunk/relaxng/NodeVAL.js
Log:
http://bugs.bitflux.ch/cgi-bin/bugzilla/show_bug.cgi?id=888
"Element count not validated"


Modified: trunk/relaxng/ElementVAL.js
==============================================================================
--- trunk/relaxng/ElementVAL.js	(original)
+++ trunk/relaxng/ElementVAL.js	Thu Oct  6 19:10:17 2005
@@ -157,7 +157,7 @@
 XMLNodeElement.prototype.__defineGetter__ ("canHaveText",
 	function() {
 		
-		if (typeof this.vdom == "undefined") {
+		if (this.vdom ==null || typeof this.vdom == "undefined") {
 			//bad hack...
 			return true;
 		}

Modified: trunk/relaxng/NodeVAL.js
==============================================================================
--- trunk/relaxng/NodeVAL.js	(original)
+++ trunk/relaxng/NodeVAL.js	Thu Oct  6 19:10:17 2005
@@ -65,7 +65,6 @@
 		// TODO: test if this node is valid, we do only check childrens for the moment..	
 		}
 	}
-	debug ("_isNodeValid " + this.nodeName );
 	try {
 		if (this.vdom) {
 			var ctxt = new ContextVDOM(this, this.vdom);
@@ -91,14 +90,27 @@
 		if (  ctxt.isValid()) {
 			/*dump(ctxt.node.parentNode.nodeName +  " -> " +ctxt.node.nodeName + " is valid and has ");
 			dump(ctxt.node.hasChildNodes() + " childNodes \n");*/
-			if(ctxt.node.hasChildNodes() && deep) {
-				var refsPosition = ctxt.refs.length;
-				//var oldVdom = ctxt.node.vdom;
+			
+			if(ctxt.node.hasChildNodes()) {
+				if (deep) {
+					dump (ctxt.node.localName + " has  ChildNodes\n");
+					var refsPosition = ctxt.refs.length;
+					//var oldVdom = ctxt.node.vdom;
+					oldVdom = ctxt.vdom;	
+					var retctxt = ctxt.node._isNodeValid(deep,  wFValidityCheckLevel )
+					if (retctxt.isError) {
+						ctxt.addErrorMessages(retctxt.errormsg);
+					} 
+				}
+			} else if (ctxt.node.nodeType == 1) {
+				dump (ctxt.node.localName + " has no ChildNodes\n");
+				/*var refsPosition = ctxt.refs.length;
 				oldVdom = ctxt.vdom;	
 				var retctxt = ctxt.node._isNodeValid(deep,  wFValidityCheckLevel )
 				if (retctxt.isError) {
 					ctxt.addErrorMessages(retctxt.errormsg);
-				} 
+				}*/
+				
 			}
 		} else {
 				var _msg = "";
@@ -107,7 +119,7 @@
 					} else { 
 						_msg = ctxt.node.localName +"("+ctxt.node.namespaceURI+ ") ";
 					}
-				if (ctxt.node.parentNode.isAllowedChild(ctxt.node)) {
+				if (ctxt.node.parentNode.isAllowedChild(ctxt.node.namespaceURI, ctxt.node.localName)) {
 					
 					_msg += "is not allowed at this position as child of  " + this.localName ;
 				}
@@ -117,6 +129,7 @@
 				ctxt.setErrorMessage(_msg);
 		}
 		//debug ("---------");
+		
 	} while (ctxt.next() )
 
 	
@@ -128,8 +141,9 @@
 function ContextVDOM (node,vdom) {
 	this.node = node.firstChild;
 	this.nr = ctxtcounter++;
-	debug (node.nodeName);
-/*	debug (vdom.nodeName);
+	
+/*	debug (node.nodeName);
+	debug (vdom.nodeName);
 */	this.isError = false;
 	this.errormsg = new Array();
 	this.refs = new Array();
@@ -140,7 +154,6 @@
 		this.vdom = null;
 	}
 	
-	
 }
 
 ContextVDOM.prototype.next = function() {
@@ -196,6 +209,7 @@
 	if (nextSib) {
 		this.vdom = nextSib;
 	}  else {
+		this.vdom = null;
 		return null;
 	}
 	return this.vdom;
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.