I have a memory leak happening... I believe it is due to Dom parser...
could anyone help me with this: Do I need a delete???
///////////////////////////////////////////////
//Code on Main HTML page:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" SRC="Engine.js" ></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="Sarissa.js" </SCRIPT>
</head>
<body>
<script type="text/javascript">
rXML = ' <CLS <Name>John</Name <GPA>43</GPA </CLS>';
var cXML = ' <CLS <Name>Sam</Name <GPA>43</GPA </CLS>';
var pro = new InitRankEngine(cXML);
document.write('<BR' + pro.EngineRank(rXML) );
</script>
</body>
</html>
///////////////////////////////////////////////////////////////////////////////////////////
//Code in the Engine.js
// defining the class
function InitRankEngine(XML)
{
// initialize the member variables for this instance
this.XML = XML;
this.pXML = Sarissa.getDomDocument();
this.pXML = (new DOMParser()).parseFromString(this.XML, "text/xml");
// initialize the member function references for the class prototype
if (typeof(_InitRankEngine_prototype_called) == 'undefined')
{
_InitRankEngine_prototype_called = true;
InitRankEngine.prototype.EngineRank = EngineRank;
}
function EngineRank(sXML)
{
var sTmp = '';
var posXML = Sarissa.getDomDocument();
posXML = (new DOMParser()).parseFromString(sXML, "text/xml");
sTmp = this.CalcRank(posXML, this.pXML, 1, 1);
// delete(posXML);
return sTmp;
}
function CalcRank(posXML, profXML, calcMatch, usePosFactors)
{
var SecScore = 0;
try
{
iFir = profXML.selectNodes("//GPA/text()")[0].nodeValue;
iSec = posXML.selectNodes("//GPA/text()")[0].nodeValue;
SecScore = 5;
}
catch(err)
{
}
return SecScore;
}
}