Beispiel #1
0
 /// <summary>
 /// This method adds an attribute to an element node.
 /// </summary>
 /// <param name="indexElement">
 /// Element's position where an attribute will be added.
 /// </param>
 /// <param name="sCLPrivate">
 /// tPrivate object that it is been edited.
 /// </param>
 /// <param name="name">
 /// Local name that will be assigned to the attribute.
 /// </param>
 /// <param name="value">
 /// URI of the name space that will be assigned to the attribute.
 /// </param>
 public void AddAttribute(int indexElement, tPrivate sCLPrivate, string name, string value)
 {
     if (!(sCLPrivate.Any[indexElement] is XmlElementHierachy))
     {
         XmlDocument        doc        = new XmlDocument();
         XmlElementHierachy newElement = new XmlElementHierachy(sCLPrivate.Any[indexElement].Prefix, sCLPrivate.Any[indexElement].LocalName, sCLPrivate.Any[indexElement].NamespaceURI, doc);
         for (int x = 0; sCLPrivate.Any[indexElement].Attributes != null && x < sCLPrivate.Any[indexElement].Attributes.Count; x++)
         {
             newElement.SetAttribute(sCLPrivate.Any[indexElement].Attributes[x].Name, sCLPrivate.Any[indexElement].Attributes[x].Value);
         }
         sCLPrivate.Any[indexElement] = newElement;
     }
     (sCLPrivate.Any[indexElement] as XmlElementHierachy).SetAttribute(name, value);
 }
Beispiel #2
0
        /// <summary>
        /// This method modifies the values of an element node.
        /// </summary>
        /// <param name="indexElement">
        /// Position of the element that will be updated his values.
        /// </param>
        /// <param name="sCLPrivate">
        /// tPrivate object that has been edited.
        /// </param>
        /// <param name="prefix">
        /// New value of the prefix of the space of element node.
        /// </param>
        /// <param name="localName">
        /// New local name that will be set to the element node.
        /// </param>
        /// <param name="namespaceURI">
        /// New URI of name space that will be set to the element node.
        /// </param>
        /// <param name="valueElement">
        /// New value that will be set to the element node.</param>
        public void ModifyElement(int indexElement, tPrivate sCLPrivate, string prefix, string localName, string namespaceURI, string valueElement)
        {
            XmlNode[]          ObjXmlNode = sCLPrivate.Any;
            XmlDocument        doc        = new XmlDocument();
            XmlElementHierachy newElement = new XmlElementHierachy(prefix, localName, namespaceURI, doc);

            if (!string.IsNullOrEmpty(valueElement))
            {
                newElement.InnerText = valueElement;
            }
            for (int x = 0; sCLPrivate.Any[indexElement].Attributes != null && x < sCLPrivate.Any[indexElement].Attributes.Count; x++)
            {
                newElement.SetAttribute(sCLPrivate.Any[indexElement].Attributes[x].Name, sCLPrivate.Any[indexElement].Attributes[x].Value);
            }
            ObjXmlNode[indexElement] = newElement;
            sCLPrivate.Any           = ObjXmlNode;
        }
Beispiel #3
0
 /// <summary>
 /// This method modifies the values of an attribute node.
 /// </summary>
 /// <param name="indexElement">
 /// Element's position where an attribute will be modified.
 /// </param>
 /// <param name="indexAttribute">
 /// Attribute's position to edit.
 /// </param>
 /// <param name="sCLPrivate">
 /// tPrivate object that it is been modified.
 /// </param>
 /// <param name="name">
 /// New local name that will be set to the attribute.
 /// </param>
 /// <param name="value">
 /// New URI of the name space that will be set to the attribute.
 /// </param>
 public void ModifyAttribute(int indexElement, int indexAttribute, tPrivate sCLPrivate, string name, string value)
 {
     if (!(sCLPrivate.Any[indexElement] is XmlElementHierachy))
     {
         XmlDocument        doc        = new XmlDocument();
         XmlElementHierachy newElement = new XmlElementHierachy(sCLPrivate.Any[indexElement].Prefix, sCLPrivate.Any[indexElement].LocalName, sCLPrivate.Any[indexElement].NamespaceURI, doc);
         for (int x = 0; sCLPrivate.Any[indexElement].Attributes != null && x < sCLPrivate.Any[indexElement].Attributes.Count; x++)
         {
             newElement.SetAttribute(sCLPrivate.Any[indexElement].Attributes[x].Name, sCLPrivate.Any[indexElement].Attributes[x].Value);
         }
         sCLPrivate.Any[indexElement] = newElement;
     }
     if (indexAttribute != 0)
     {
         (sCLPrivate.Any[indexElement] as XmlElementHierachy).SetAttribute(name, value);
         (sCLPrivate.Any[indexElement].Attributes).InsertAfter(sCLPrivate.Any[indexElement].Attributes[sCLPrivate.Any[indexElement].Attributes.Count - 1], sCLPrivate.Any[indexElement].Attributes[indexAttribute - 1]);
     }
     else
     {
         (sCLPrivate.Any[indexElement] as XmlElementHierachy).SetAttribute(name, value);
         sCLPrivate.Any[indexElement].Attributes.Prepend(sCLPrivate.Any[indexElement].Attributes[sCLPrivate.Any[indexElement].Attributes.Count - 1]);
     }
 }
Beispiel #4
0
        /// <summary>
        /// This method adds an element node to the tPrivate object.
        /// </summary>
        /// <param name="sCLPrivate">
        /// tPrivate object that it's been edited.
        /// </param>
        /// <param name="prefix">
        /// New value of the space prefix of the element node.
        /// </param>
        /// <param name="localName">
        /// Local name that will be set to the element node.
        /// </param>
        /// <param name="namespaceURI">
        /// URI of the space name that will be set to the element node.
        /// </param>
        /// <param name="valueElement">
        /// Value that will be set to the element node.
        /// </param>
        public void AddElement(tPrivate sCLPrivate, string prefix, string localName, string namespaceURI, string valueElement)
        {
            XmlNode[]          ObjXmlNode = new XmlNode[1];
            XmlDocument        doc        = new XmlDocument();
            XmlElementHierachy newElement = new XmlElementHierachy(prefix, localName, namespaceURI, doc);

            if (!string.IsNullOrEmpty(valueElement))
            {
                newElement.InnerText = valueElement;
            }
            ObjXmlNode[0] = newElement;
            if (sCLPrivate.Any == null)
            {
                sCLPrivate.Any = ObjXmlNode;
            }
            else
            {
                XmlNode[] ObjXmlNodeTemp = new XmlNode[sCLPrivate.Any.Length + 1];
                sCLPrivate.Any.CopyTo(ObjXmlNodeTemp, 0);
                ObjXmlNodeTemp[sCLPrivate.Any.Length] = ObjXmlNode[0];
                sCLPrivate.Any = ObjXmlNodeTemp;
            }
        }