Beispiel #1
0
        public void EndElement(string localName, string qName)
        {
            string type = localName;

            if (string.Compare(rdfRoot, type, true) != 0)
            {
                //// end of main element
                if (inLevel == Level.Element)
                {
                    inLevel = Level.Root;
                    if (currentElement != null)
                    {
                        if (model.GetObjectByID(currentElement.ID) == null)
                        {
                            model.InsertObjectInModelMap(currentElement);
                        }

                        currentElement = null;
                    }
                }
                //// end of an attribute (property)
                else if (inLevel == Level.Property)
                {
                    inLevel = Level.Element;
                    content = content.Trim();
                    if (!string.IsNullOrEmpty(content))
                    {
                        if (currentAttribute != null)
                        {
                            //// if attribute value wasn't set as the reference, we read the text content and set it in value
                            if (string.IsNullOrEmpty(currentAttribute.Value))
                            {
                                currentAttribute.Value = content;
                            }
                        }
                        content = string.Empty;
                    }

                    AddAttributeToCurrentElement();
                }
            }
        }
Beispiel #2
0
        public override void EndElement(string localName, string qName, int lineNumber = 0, int columnNumber = 0)
        {
            string type = localName;

            if (string.Compare(rdfRoot, type, true) != 0)
            {
                //// end of main element
                if (inLevel == Level.Element)
                {
                    inLevel = Level.Root;
                    if (currentElement != null)
                    {
                        currentElement.SourceEndLine   = lineNumber;
                        currentElement.SourceEndColumn = columnNumber + qName.Length + 3;
                        if (model.GetObjectByID(currentElement.ID) == null)
                        {
                            model.InsertObjectInModelMap(currentElement);
                        }
                        else
                        {
                            AddValidationMessageAboutDuplicateRdfId();
                        }
                        currentElement = null;
                    }
                }
                //// end of embededList of elements
                else if (inLevel == Level.EmbeddedList)
                {
                    inLevel          = Level.Element;
                    embeddedListName = string.Empty;
                }
                //// end of embeded element
                else if (inLevel == Level.EmbeddedElement)
                {
                    inLevel = Level.EmbeddedList;
                    if (embeddedElement != null)
                    {
                        embeddedElement.SourceEndLine   = lineNumber;
                        embeddedElement.SourceEndColumn = columnNumber + qName.Length + 3;
                        if (model.GetObjectByID(embeddedElement.ID) == null)
                        {
                            model.InsertObjectInModelMap(embeddedElement);
                        }
                        else
                        {
                            AddValidationMessageAboutDuplicateRdfId();
                        }
                        embeddedElement = null;
                    }
                }
                //// end of an attribute (property)
                else if (inLevel == Level.Property)
                {
                    if (embeddedElement == null)
                    {
                        inLevel = Level.Element;
                    }
                    else
                    {
                        inLevel = Level.EmbeddedElement;
                    }

                    content = content.Trim();
                    if (!string.IsNullOrEmpty(content))
                    {
                        if (currentAttribute != null)
                        {
                            //// if attribute value wasn't set as the reference, we read the text content as set it in value
                            if (string.IsNullOrEmpty(currentAttribute.Value))
                            {
                                currentAttribute.Value = content;
                                if (string.IsNullOrEmpty(currentAttribute.Value))
                                {
                                    AddValidationMessageAboutEmptyValueOfProperty();
                                }
                            }
                        }
                        content = string.Empty;
                    }

                    AddAttributeToCurrentElement();
                }
            }
        }