Symbian.org/FeedUpdateBroker.js
changeset 15 5e64ec5b1dfe
parent 13 3a1db8573f1e
child 16 6544cc5386ce
equal deleted inserted replaced
14:631ddb2767c7 15:5e64ec5b1dfe
   163 		if (child.nodeType == Node.TEXT_NODE || child.nodeType == Node.CDATA_SECTION_NODE) {
   163 		if (child.nodeType == Node.TEXT_NODE || child.nodeType == Node.CDATA_SECTION_NODE) {
   164 			// append text to buffer
   164 			// append text to buffer
   165 			if (buf != "") {
   165 			if (buf != "") {
   166 				buf += " ";
   166 				buf += " ";
   167 			}
   167 			}
   168 			buf += child.textContent;
   168 			buf += child.nodeValue;
   169 //				buf += doEscapeLtGt(child.nodeValue);
       
   170 		}
   169 		}
   171 		child = child.nextSibling;
   170 		child = child.nextSibling;
   172 	}
   171 	}
   173 	
   172 	
   174 	return buf;
   173 	return buf;
   175 //    // strip all tags from the buffer
       
   176 //    var strippedBuf = "";
       
   177 //    var textStartPos = -1;
       
   178 //    var tagBalance = 0;
       
   179 //	
       
   180 //    var pos;
       
   181 //    // iterate through the text and append all text to the stripped buffer
       
   182 //    // that is at a tag balance of 0
       
   183 //    for (pos = 0; pos < buf.length; pos++) {
       
   184 //        var c = buf.charAt(pos);
       
   185 //        if (c == '<') {
       
   186 //            // entering a tag
       
   187 //            if (tagBalance == 0 && textStartPos != -1) {
       
   188 //                // everything up to here was valid text
       
   189 //                strippedBuf += buf.substring(textStartPos, pos);
       
   190 //                textStartPos = -1;
       
   191 //            }
       
   192 //            tagBalance++;
       
   193 //        } else if (c == '>') {
       
   194 //            // leaving a tag
       
   195 //            tagBalance--;
       
   196 //            textStartPos = -1;
       
   197 //        } else if (tagBalance == 0 && textStartPos == -1) {
       
   198 //            // first char of text
       
   199 //            textStartPos = pos;
       
   200 //        }
       
   201 //    }
       
   202 //    
       
   203 //    // add remaining text - if any
       
   204 //    if (tagBalance == 0 && textStartPos != -1) {
       
   205 //        strippedBuf += buf.substring(textStartPos, pos);
       
   206 //    }
       
   207     
       
   208 //    return strippedBuf;
       
   209 }
   174 }
   210 
   175 
   211 FeedUpdateBroker.prototype.cancel = function() {
   176 FeedUpdateBroker.prototype.cancel = function() {
   212 	this.cancelled = true;
   177 	this.cancelled = true;
   213 	this.httpReq.abort();
   178 	this.httpReq.abort();
   214 }
   179 }
   215 
       
   216 function doEscapeLtGt(text){
       
   217 	var lt = "&lt;";
       
   218 	var gt = "&gt;";
       
   219 	return text.replace(/</g, lt).replace(/>/g, gt);
       
   220 }