Example #1
0
        public void PushXmlContext(XElement element)
        {
            var newC = new TemplatorXmlParsingContext
            {
                ElementList  = element.Nodes().ToArray(),
                Element      = element,
                ElementIndex = 0
            };

            XmlStack.Push(XmlContext);
            XmlContext = newC;
        }
Example #2
0
 public void StartOver(bool clearHolders = true)
 {
     RemovingElements.Clear();
     Stack = null;
     XmlStack.Clear();
     XmlContext = null;
     Context    = new TemplatorParsingContext();
     Csv        = false;
     NoInput    = false;
     if (clearHolders)
     {
         Holders.Clear();
     }
 }
Example #3
0
 public virtual XElement ParseXml(XElement rootElement, IDictionary <string, object> input, IDictionary <string, TextHolder> preparsedHolders = null, string mergeHoldersInto = null)
 {
     XmlContext = new TemplatorXmlParsingContext {
         Element = rootElement
     };
     PushContext(input, null, null);
     Context.PreparsedHolders = preparsedHolders;
     ParseXmlInternal(rootElement);
     if (preparsedHolders != null)
     {
         input.AddOrOverwrite(Config.KeyHolders, preparsedHolders);
     }
     foreach (var removingElement in RemovingElements)
     {
         if (removingElement?.Parent != null)
         {
             removingElement.Remove();//RemoveWithNextWhitespace
         }
     }
     CollectHolderResults(mergeHoldersInto);
     return(XmlContext.Element);
 }
Example #4
0
 public void PopXmlContext()
 {
     XmlContext = XmlStack.Pop();
 }