public Group createGroup(string id)
        {
            if (getGroup(id) != null)
            {
                throw new DuplicateIdException("The group with " + id + " exist!");
            }
            Group group = new GroupImpl(this, id, null);

            groups.Add(group);
            return(group);
        }
        public Group addGroup(Group group, bool deepCopy)
        {
            if (getGroup(group.getId()) != null)
            {
                throw new DuplicateIdException("The group with " + group.getId() + " exist!");
            }
            Group        myGroup      = new GroupImpl(this, group.getId(), group.getComment());
            List <Entry> groupEntries = group.getEntries();

            foreach (Entry groupEntry in groupEntries)
            {
                myGroup.addEntry(addEntry(groupEntry, deepCopy));
            }

            groups.Add(myGroup);
            return(myGroup);
        }
        private void parse()
        {
            //DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            //factory.setNamespaceAware(true);

            //var fis = new BinaryReader(File.OpenRead(absoluteFileName));
            //DocumentBuilder documentBuilder = factory.newDocumentBuilder();
            var document = new XmlDocument();// documentBuilder.parse(fis);

            document.Load(absoluteFileName);
            string validate = UserSettings.Default[Constants.PROPERTIE_VALIDATION].ToString();

            if (validate != null && validate.ToLower().Equals("true"))
            {
                this.validate(document);
            }

            XmlNode unisensNode       = document.DocumentElement;//.getDocumentElement();
            var     unisensChildNodes = unisensNode.ChildNodes;

            parse(unisensNode);

            XmlNode currentNode;

            EntryImpl   entry   = null;
            ContextImpl context = null;
            GroupImpl   group   = null;

            for (int i = 0; i < unisensChildNodes.Count; i++)
            {
                currentNode = unisensChildNodes.Item(i);
                if (currentNode.NodeType == XmlNodeType.Element)
                {
                    if (currentNode.Name.ToUpper().Equals(Constants.SIGNALENTRY.ToUpper()))
                    {
                        entry = new SignalEntryImpl(this, currentNode);
                        entries.Add(entry);
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.EVENTENTRY.ToUpper()))
                    {
                        entry = new EventEntryImpl(this, currentNode);
                        entries.Add(entry);
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.CUSTOMENTRY.ToUpper()))
                    {
                        entry = new CustomEntryImpl(this, currentNode);
                        entries.Add(entry);
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.VALUESENTRY.ToUpper()))
                    {
                        entry = new ValuesEntryImpl(this, currentNode);
                        entries.Add(entry);
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.CONTEXT.ToUpper()))
                    {
                        context      = new ContextImpl(currentNode);
                        this.context = context;
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.GROUP.ToUpper()))
                    {
                        group = new GroupImpl(this, currentNode);
                        groups.Add(group);
                        continue;
                    }
                    if (currentNode.Name.ToUpper().Equals(Constants.CUSTOM_ATTRIBUTES.ToUpper()))
                    {
                        var customAttributeNodes = currentNode.ChildNodes;
                        for (int j = 0; j < customAttributeNodes.Count; j++)
                        {
                            var customAttributeNode = customAttributeNodes.Item(j);
                            if (customAttributeNode.Name.ToUpper().Equals(Constants.CUSTOM_ATTRIBUTE.ToUpper()))
                            {
                                var    attrs   = customAttributeNode.Attributes;
                                var    keyNode = attrs.GetNamedItem(Constants.CUSTOM_ATTRIBUTE_KEY);
                                string key     = "";
                                if (keyNode != null)
                                {
                                    key = keyNode.Value;
                                }
                                var    valueNode = attrs.GetNamedItem(Constants.CUSTOM_ATTRIBUTE_VALUE);
                                string value     = "";
                                if (valueNode != null)
                                {
                                    value = valueNode.Value;
                                }
                                if (key != "")
                                {
                                    customAttributes.Add(key, value);
                                }
                            }
                        }
                    }
                }
            }
        }