Ejemplo n.º 1
0
        public ParseExecuteElements(XmlElementType elementType)
        {
            if (elementType != XmlElementType.ExecuteCommand)
            {
                var ex = new ArgumentException("Invalid XmlElement Type For this Xml Parser!");

                var err = new FileOpsErrorMessageDto
                {
                    DirectoryPath = string.Empty,
                    ErrId = 1,
                    ErrorMessage = ex.Message,
                    ErrSourceMethod = "Constructor()",
                    ErrException = ex,
                    FileName = string.Empty,
                    LoggerLevel = LogLevel.FATAL
                };

                ErrorMgr.LoggingStatus = ErrorLoggingStatus.On;
                ErrorMgr.WriteErrorMsg(err);

                throw ex;
            }

            ElementType = elementType;
        }
Ejemplo n.º 2
0
        private static object ParseElement(string tagText, out XmlElementType elementType)
        {
            elementType = XmlElementType.Open;

            if (tagText.Contains("<!--"))
            {
                // XML Comment
                elementType = XmlElementType.OpenClosed;
                return(new XmlComment(xmlCommentRegex.Match(tagText).Groups["content"].Value));
            }

            var match = xmlTagRegex.Match(tagText.Trim());

            if (match.Success)
            {
                var xmlNode = new XmlNode {
                    Name = match.Groups["tagName"].Value
                };
                PopulateAttributes(xmlNode, match.Groups["attributes"].Value);

                if (match.Groups["closed"].Length > 0)
                {
                    elementType = XmlElementType.Closed;
                }
                else if (match.Groups["openClosed"].Length > 0)
                {
                    elementType = XmlElementType.OpenClosed;
                }

                return(xmlNode);
            }

            throw new Exception("I'm to lazy to make up a description for this one");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 按照类型查找对应的语法高亮配置项
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public XmlHighlightConfig GetXmlHighlight(XmlElementType type)
 {
     return XmlHighlights.Find(delegate(XmlHighlightConfig hc)
     {
         return hc.Type == type;
     });
 }