public IXMLBuilder MoveTo(string name)
        {
            List <IXElement> filtered = Current.Elements().Where(x => x.XName == name).ToList();

            Current = filtered.Count > 0 ? filtered[0] : Root;
            return(this);
        }
        public IXMLBuilder AddElement(string name)
        {
            var temp = new XElement(name);

            Current.Add(temp);
            Current = temp;
            return(this);
        }
Exemple #3
0
 public void AssignName(IXElement element, string name)
 {
     if ((name != null) && (name.Trim().Length > 0))
     {
         XAttributeLiteral attr = (XAttributeLiteral)ATTR_NAME.Clone();
         attr.Value = name;
         element.GetAttributes().Add(QualifiedName(KEY_NAME), attr);
     }
 }
Exemple #4
0
 public string ExtractName(IXElement element)
 {
     try
     {
         return(((XAttributeLiteral)element.GetAttributes()[QualifiedName(KEY_NAME)]).Value);
     }
     catch (KeyNotFoundException)
     {
         XLogging.Log("Key '" + KEY_NAME + "' not available", XLogging.Importance.WARNING);
         return(null);
     }
 }
 public IXMLBuilder Reset()
 {
     Current = Root;
     return(this);
 }
 public XMLBuilder(string comment)
 {
     Root    = new XDocument(comment);
     Current = Root;
 }
Exemple #7
0
 public void Remove(IXElement element)
 {
     childrens.Remove(element);
 }
Exemple #8
0
 public void Add(IXElement element)
 {
     childrens.Add(element);
 }