Exemplo n.º 1
0
 private void AddAfter(Element element, string after)
 {
     if (_map.ContainsKey(after))
     {
         throw DuplicateElementIdException.Create(after);
     }
     _map.Add(after, element);
 }
Exemplo n.º 2
0
        private void PreventDuplicateIds(IEnumerable <Node> list)
        {
            var document = _parent.Document;
            var hash     = new HashSet <string>();

            foreach (var node in list)
            {
                if (!(node is Element element) || string.IsNullOrEmpty(element.Id))
                {
                    continue;
                }
                var id = element.Id;
                if (hash.Contains(id) || DuplicateIdInDocument(document, id))
                {
                    throw DuplicateElementIdException.Create(id);
                }
                hash.Add(id);
            }
        }