You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/10/26 23:53:09 UTC

svn commit: r468194 - /incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js

Author: mturyn
Date: Thu Oct 26 16:53:08 2006
New Revision: 468194

URL: http://svn.apache.org/viewvc?view=rev&rev=468194
Log:
Now converting from text node to text; also, not getting whole document if we just need the context.

Modified:
    incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js

Modified: incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js?view=diff&rev=468194&r1=468193&r2=468194
==============================================================================
--- incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js (original)
+++ incubator/xap/trunk/src/xap/data/datasource/SimpleDocumentDataSource.js Thu Oct 26 16:53:08 2006
@@ -106,10 +106,12 @@
 **/
 xap.data.datasource.SimpleDocumentDataSource.prototype.handleDataQuery = function(query, context, listener) {
 	// The document:
-	var contextObject = this.getSourceDocument() ;
+	var contextObject = null ;
 	if (context != null) {
 		contextObject = context.getData();
-	}	
+	} else {
+		contextObject =	this.getSourceDocument() ;
+	}
 
 // Objects we can use when evalling the iterator?:
 	var currentIndex = null ;
@@ -139,6 +141,10 @@
 		if( theData.length == 1 ){
 			theData = theData[0] ;
 		}
+		// If a text node, use its text value:
+		if (theData.nodeName && theData.nodeName=="#text"){
+			theData = theData.nodeValue ;
+		}
 	}
 	
 		
@@ -158,7 +164,17 @@
 **/
 xap.data.datasource.SimpleDocumentDataSource.prototype.handleDataSetQuery = function(query, context, listener) {
 	/*Object*/
-	var contextObject = this.getSourceDocument();
+	var theData = null ;
+	var contextObject = null ;
+	if (context == null ){
+		/*Object*/
+		contextObject = this.getSourceDocument();
+	} else {
+		// We had a context selecting down from the original data source
+		// ---this is an inner nested iterator:
+		contextObject = context.getData();
+	}
+
 	try {			
 		theData = xap.data.datasource.SimpleDocumentDataSource.executeQuery(contextObject, query) ;
 	} catch (anException){