static void ProcessScoresAll(XPathNavigator nav, XPathExpression xp_ScaleScore, XPathExpression xp_StdErr,
            XPathExpression xp_PerfLvl, string[] fields, int index)
        {
            string scaleScore = nav.Eval(xp_ScaleScore);
            string stdErr = nav.Eval(xp_StdErr);
            string perfLvl = nav.Eval(xp_PerfLvl);

            fields[index] = scaleScore;
            fields[index + 1] = stdErr;
            fields[index + 2] = perfLvl;
        }
        static void ProcessScoresDw(XPathNavigator nav, XPathExpression xp_ScaleScore, XPathExpression xp_StdErr,
            XPathExpression xp_PerfLvl, string[] fields, int index)
        {
            // We round fractional scale scores down to the lower whole number. This is because
            // the performance level has already been calculated on the fractional number. If
            // we rounded to the nearest whole number then half the time the number would be
            // rounded up. And if the fractional number was just below the performance level
            // cut score, a round up could show a whole number score that doesn't correspond
            // to the performance level.

            string scaleScore = Round(nav.Eval(xp_ScaleScore));
            string stdErr = Round(nav.Eval(xp_StdErr));
            string perfLvl = nav.Eval(xp_PerfLvl);

            fields[index] = scaleScore;
            fields[index + 3] = perfLvl;

            int scaleScoreN;
            int stdErrN;
            if (int.TryParse(scaleScore, out scaleScoreN) && int.TryParse(stdErr, out stdErrN))
            {
                // MinimumValue
                fields[index + 1] = (scaleScoreN - stdErrN).ToString("d", System.Globalization.CultureInfo.InvariantCulture);
                // MaximumValue
                fields[index + 2] = (scaleScoreN + stdErrN).ToString("d", System.Globalization.CultureInfo.InvariantCulture);
            }
            else
            {
                fields[index + 1] = string.Empty;
                fields[index + 2] = string.Empty;
            }
        }
 static string CalcResponseDuration(XPathNavigator navDoc, XPathNavigator navItem)
 {
     string pageNum = navItem.Eval(sXp_PageNumber);
     string pageTime = navItem.Eval(sXp_PageTime);
     long milliseconds;
     if (!string.IsNullOrEmpty(pageNum) &&
         long.TryParse(pageTime, NumberStyles.AllowDecimalPoint|NumberStyles.AllowLeadingWhite|NumberStyles.AllowTrailingWhite, CultureInfo.InvariantCulture, out milliseconds))
     {
         int itemCount = CountItemsOnPage(navDoc, pageNum);
         if (itemCount < 1) itemCount = 1;
         return ((milliseconds / 1000.0) / (long)itemCount).ToString("F3", CultureInfo.InvariantCulture);
     }
     else
     {
         return "0";
     }
 }