Ejemplo n.º 1
0
        internal static System.Xml.Linq.XElement ToXml(ParamValuesNode model)
        {
            if (model == null)
            {
                return(null);
            }
            XElement element = new XElement(model.Name);

            element.Value = model.GetString(null);
            //if (!string.IsNullOrEmpty(model.IssuerElementId)) element.Add(new XAttribute("id", model.IssuerElementId));
            //element.Add(new XAttribute("type", "ComplexType"));
            if (model.Attributs != null)
            {
                foreach (var attributeKey in model.Attributs.Keys)
                {
                    string val = model.GetString(attributeKey, DataAccessorOptionEnum.None);
                    if (string.IsNullOrEmpty(val))
                    {
                        continue;                            // cela sert à rien d'écrire un attribut vide
                    }
                    XAttribute nodeAttribute = new XAttribute(attributeKey, val);
                    element.Add(nodeAttribute);
                }
            }

            return(element);
        }
Ejemplo n.º 2
0
 private XmlTextWriter savewritenode(XmlTextWriter XmlTextWriter, ParamValuesNode datatab, string item)
 {
     if (datatab.Value == null)
     {
         datatab.Value = "";                        //Attention aux noeuds null...
     }
     XmlTextWriter.WriteStartElement(item);
     foreach (var attribut in datatab.Attributs)
     {
         XmlTextWriter.WriteAttributeString(attribut.Key, Convert.ToString(attribut.Value));
     }
     XmlTextWriter.WriteValue(datatab.GetString(null));
     return(XmlTextWriter);
 }