Example #1
0
        private void HandleCloseTag(EndElementEvent end)
        {
            var elementName    = end.Name;
            var content        = end.Descendants;
            var startCandidate = _stack.Peek() as StartElementEvent;

            if (startCandidate != null)
            {
                if (!string.Equals(startCandidate.Name, elementName))
                {
                    _observer.OnError(new ApplicationException($"unexpected closing tag. expected: {startCandidate.Name} actual: {elementName}"));
                }
                else
                {
                    _stack.Pop();
                    //TODO: check if end and start are interchangable here
                    _observer.OnNext(ProjectStructureItem.Build(startCandidate, content));
                    return;
                }
            }
            _observer.OnError(new ApplicationException($"unexpected end element: {elementName}"));
        }
Example #2
0
 private void HandleClosedTag(EndElementEvent end)
 {
     _observer.OnNext(ProjectStructureItem.Build(end));
 }