public static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos, bool overrideExist)
        {
            if (pos == XmlPropertyPosition.ChildNode)
            {
                if (overrideExist)
                {
                    foreach (XmlNode childNode in objNode.ChildNodes)
                    {
                        if (childNode.Name == proName)
                        {
                            childNode.InnerText = val;
                            return;
                        }
                    }
                }

                XmlNode newChildNode = objNode.OwnerDocument.CreateElement(proName);
                newChildNode.InnerText = val;
                objNode.AppendChild(newChildNode);
            }
            else
            {
                if (overrideExist)
                {
                    foreach (XmlAttribute attr in objNode.Attributes)
                    {
                        if (attr.Name == proName)
                        {
                            attr.Value = val;
                            return;
                        }
                    }
                }

                XmlAttribute newAttr = objNode.OwnerDocument.CreateAttribute(proName);
                objNode.Attributes.Append(newAttr);
                newAttr.Value = val;
            }
        } 
Exemple #2
0
        private static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos)
        {
            if (pos == XmlPropertyPosition.ChildNode)
            {
                foreach (XmlNode childNode in objNode.ChildNodes)
                {
                    if (childNode.Attributes["name"].Value == proName)
                    {
                        childNode.Attributes["value"].Value = val;
                        return;
                    }
                }

                XmlNode      newChildNode = objNode.OwnerDocument.CreateElement("property");
                XmlAttribute proNameAttr  = objNode.OwnerDocument.CreateAttribute("name");
                proNameAttr.Value = proName;
                newChildNode.Attributes.Append(proNameAttr);

                XmlAttribute proValueAttr = objNode.OwnerDocument.CreateAttribute("value");
                proValueAttr.Value = val;
                newChildNode.Attributes.Append(proValueAttr);

                objNode.AppendChild(newChildNode);
            }
            else
            {
                foreach (XmlAttribute attr in objNode.Attributes)
                {
                    if (attr.Name == proName)
                    {
                        attr.Value = val;
                        return;
                    }
                }

                XmlAttribute newAttr = objNode.OwnerDocument.CreateAttribute(proName);
                objNode.Attributes.Append(newAttr);
                newAttr.Value = val;
            }
        }
Exemple #3
0
 private static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos)
 {
     if (pos == XmlPropertyPosition.ChildNode)
     {
         foreach (XmlNode node in objNode.ChildNodes)
         {
             if (node.Attributes["name"].Value == proName)
             {
                 node.Attributes["value"].Value = val;
                 return;
             }
         }
         XmlNode      newChild  = objNode.OwnerDocument.CreateElement("property");
         XmlAttribute attribute = objNode.OwnerDocument.CreateAttribute("name");
         attribute.Value = proName;
         newChild.Attributes.Append(attribute);
         XmlAttribute attribute2 = objNode.OwnerDocument.CreateAttribute("value");
         attribute2.Value = val;
         newChild.Attributes.Append(attribute2);
         objNode.AppendChild(newChild);
     }
     else
     {
         foreach (XmlAttribute attribute3 in objNode.Attributes)
         {
             if (attribute3.Name == proName)
             {
                 attribute3.Value = val;
                 return;
             }
         }
         XmlAttribute attribute4 = objNode.OwnerDocument.CreateAttribute(proName);
         objNode.Attributes.Append(attribute4);
         attribute4.Value = val;
     }
 }
 public static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos)
 {
     XmlHelper.SetPropertyValue(objNode, proName, val, pos, true);
 }
Exemple #5
0
        public static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos, bool overrideExist)
        {
            if (pos == XmlPropertyPosition.ChildNode)
            {
                if (overrideExist)
                {
                    foreach (XmlNode childNode in objNode.ChildNodes)
                    {
                        if (childNode.Name == proName)
                        {
                            childNode.InnerText = val;
                            return;
                        }
                    }
                }

                XmlNode newChildNode = objNode.OwnerDocument.CreateElement(proName);
                newChildNode.InnerText = val;
                objNode.AppendChild(newChildNode);
            }
            else
            {
                if (overrideExist)
                {
                    foreach (XmlAttribute attr in objNode.Attributes)
                    {
                        if (attr.Name == proName)
                        {
                            attr.Value = val;
                            return;
                        }
                    }
                }

                XmlAttribute newAttr = objNode.OwnerDocument.CreateAttribute(proName);
                objNode.Attributes.Append(newAttr);
                newAttr.Value = val;
            }
        }
Exemple #6
0
 public static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos)
 {
     XmlHelper.SetPropertyValue(objNode, proName, val, pos, true);
 }
        private static void SetPropertyValue(XmlNode objNode, string proName, string val, XmlPropertyPosition pos)
        {
            if (pos == XmlPropertyPosition.ChildNode)
            {
                foreach (XmlNode childNode in objNode.ChildNodes)
                {
                    if (childNode.Attributes["name"].Value == proName)
                    {
                        childNode.Attributes["value"].Value = val;
                        return;
                    }
                }

                XmlNode newChildNode = objNode.OwnerDocument.CreateElement("property");
                XmlAttribute proNameAttr = objNode.OwnerDocument.CreateAttribute("name");
                proNameAttr.Value = proName;
                newChildNode.Attributes.Append(proNameAttr);

                XmlAttribute proValueAttr = objNode.OwnerDocument.CreateAttribute("value");
                proValueAttr.Value = val;
                newChildNode.Attributes.Append(proValueAttr);

                objNode.AppendChild(newChildNode);
            }
            else
            {
                foreach (XmlAttribute attr in objNode.Attributes)
                {
                    if (attr.Name == proName)
                    {
                        attr.Value = val;
                        return;
                    }
                }

                XmlAttribute newAttr = objNode.OwnerDocument.CreateAttribute(proName);
                objNode.Attributes.Append(newAttr);
                newAttr.Value = val;
            }
        }