/// <summary>
 /// Get the init sdml property from an AusFarm component's init section.
 /// </summary>
 /// <param name="compNode">The xml node for the component</param>
 /// <param name="varName">Name of the init value</param>
 /// <returns>An TSDMLValue</returns>
 private TSDMLValue GetTypedInit(XmlNode compNode, string varName)
 {
     TSDMLValue init = null;
     if (compNode != null)
     {
         TCompParser comp = new TCompParser(compNode.OuterXml);
         if (!comp.IsAPSRU())
         {
             //AusFarm inits
             string sdml = comp.initTextByName(varName);
             if (sdml.Length > 0)
             {
                 init = new TSDMLValue(sdml, "");
             }
         }
     }
     return init;
 }
        private void SetTypedValue(XmlNode compNode, string varName, string value)
        {
            TSDMLValue init = null;
            if (compNode != null)
            {
                TCompParser comp = new TCompParser(compNode.OuterXml);
                //AusFarm inits
                string sdml = comp.initTextByName(varName);
                if (sdml.Length > 0)
                {
                    init = new TSDMLValue(sdml, "");
                }

                init.setValue(value);

                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() + "]]>";
            }
        }