예제 #1
0
        public static String GetPath(AXmlElement activeElement)
        {
            String      path   = activeElement.Name;
            AXmlElement parent = activeElement;

            while ((parent = AXmlFinder.FindOwnerElement(parent, false)) != null)
            {
                path = parent.Name + "\\" + path;
            }
            return(path);
        }
예제 #2
0
        public void ActiveOnOffset(int textOffset)
        {
            SetCaretOffset(textOffset);
            AXmlObject xmlObj = xDoc.GetChildAtOffset(textOffset);

            backgroundRenderer.HighlightColor = Color.FromArgb(0x40, 0, 0, 0xFF);
            ActiveObject = xmlObj;

            _activeIndex = -1; //초기값..

            if (xmlObj is AXmlText)
            {
                if (xmlObj.Parent != null && xmlObj.Parent is AXmlTag)
                {
                    AXmlTag tag = xmlObj.Parent as AXmlTag;
                    if (tag.OpeningBracket.Equals("<!--"))//comment
                    {
                        ActiveComment = tag;
                        ActiveElement = null;
                        _activeIndex  = GetIndex(tag, true);
                    }
                    else
                    {
                        ActiveComment = null;
                    }
                }
                else
                {
                    ActiveComment = null;
                }
            }
            else if (xmlObj is AXmlTag)
            {
                AXmlTag tag = xmlObj as AXmlTag;
                if (tag.OpeningBracket.Equals("<!--"))//comment
                {
                    ActiveComment = tag;
                    ActiveElement = null;
                    _activeIndex  = GetIndex(tag, true);
                }
                else
                {
                    ActiveComment = null;
                }
            }
            else
            {
                ActiveComment = null;
            }

            if (ActiveComment == null)
            {
                ActiveElement = AXmlFinder.FindOwnerElement(xmlObj, true);
                if (ActiveElement != null)
                {
                    _activeIndex = GetIndex(ActiveElement, true);
                }
            }

            if (xmlObj is AXmlAttribute)
            {
                ActiveAttribute = xmlObj as AXmlAttribute;
            }
            else if ((xmlObj is AXmlElement) == false && (xmlObj is AXmlTag))
            {
                ActiveAttribute = null;
            }
            else
            {
                ActiveAttribute = null;
            }



            if (ActiveComment != null)
            {
                backgroundRenderer.HighlightObjects = new AXmlObject[] { ActiveComment }
            }