r1413 - trunk/relaxng

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Tue Dec  6 14:13:45 2005
New Revision: 1413

Modified:
   trunk/relaxng/ElementVDOM.js
   trunk/relaxng/RelaxNG.js
Log:
ZeroOrMore Patch

Modified: trunk/relaxng/ElementVDOM.js
==============================================================================
--- trunk/relaxng/ElementVDOM.js	(original)
+++ trunk/relaxng/ElementVDOM.js	Tue Dec  6 14:13:45 2005
@@ -107,6 +107,7 @@
 
 
 ElementVDOM.prototype.isValid = function(ctxt) {
+	//dump("ElementVDOM.isValid " + this.localName + "\n");
 	if (ctxt.node.localName == this.localName && ctxt.node.namespaceURI == this.namespaceURI) {
 		
 		

Modified: trunk/relaxng/RelaxNG.js
==============================================================================
--- trunk/relaxng/RelaxNG.js	(original)
+++ trunk/relaxng/RelaxNG.js	Tue Dec  6 14:13:45 2005
@@ -470,12 +470,10 @@
 				this._hasEmpty = false;
 				break;
 			case "zeroOrMore":
-				newOneOrMore = new OneOrMoreVDOM(childNodes[i]);
-				this.appendChild(newOneOrMore);
-				newOneOrMore.appendChild(new EmptyVDOM());
-				newOneOrMore.parseChildren(childNodes[i]);
-				newOneOrMore.optional = true;
-				this._hasEmpty = false;
+				newZeroOrMore = new ZeroOrMoreVDOM(childNodes[i]);
+				this.appendChild(newZeroOrMore);
+				this._hasEmpty = true;
+				newZeroOrMore.parseChildren(childNodes[i]);
 				break;
 			case "attribute":
 				this.addAttributeNode( new AttributeVDOM(childNodes[i]));
@@ -671,19 +669,20 @@
 
 	while (child) {
 		if (child.isValid(ctxt)) {
+			ctxt.setVDOM(this, refsPosition);
 			return true;
 		}
 		child = child.getNextSibling(ctxt);
 	}
+	
+	ctxt.setVDOM(this, refsPosition);
 	var vdom = ctxt.nextVDOM();
 	if (vdom) {
-		var v =  vdom.isValid(ctxt);
-		if (v) {
-			ctxt.setVDOM(this, refsPosition);
-		}
-		return v;
+		return vdom.isValid(ctxt); 
+	} else { 
+		return false;
 	}
-	return false;
+	
 }
 
 ZeroOrMoreVDOM.prototype.allowedElements = function(ctxt) {
-- 
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.