/// <summary>
 /// Set the init value in the document using the TSDMLValue passed in.
 /// </summary>
 /// <param name="compNode">Component node in the document</param>
 /// <param name="varName">Name of the variable in the AusFarm init section</param>
 /// <param name="init">The TTypedValue with the required settings</param>
 private void SetTypedInit(XmlNode compNode, string varName, TSDMLValue init)
 {
     if (compNode != null)
     {
         TCompParser comp = new TCompParser(compNode.OuterXml);
         if (!comp.IsAPSRU())
         {
             StringBuilder newInitSection = new StringBuilder();
             newInitSection.Append("<initsection>");
             //AusFarm inits
             //find the init node in the section
             uint i = 1;
             while (i <= comp.initCount())
             {
                 if (comp.initName(i) == varName)
                 {
                     string initStr = init.getText(init, 0, 2);
                     initStr = initStr.Replace("&#39;", "'");    //replace any escaped single quotes
                     newInitSection.Append(initStr);
                 }
                 else
                     newInitSection.Append(comp.initText(i));
                 i++;
             }
             newInitSection.Append("</initsection>");
             XmlNode initdata = compNode.SelectSingleNode("initdata");
             initdata.InnerXml = "<![CDATA[" + newInitSection.ToString() + "]]>";
         }
     }
 }