コード例 #1
0
 protected abstract void ParseContent(XmlModelElementAnalyzer a, XmlDocParsingContext c);
コード例 #2
0
 protected abstract void ParseAttributes(XmlModelAttributesAnalyzer a, XmlDocParsingContext c);
コード例 #3
0
 public void Parse(XmlModelElementAnalyzer a, XmlDocParsingContext c)
 {
     this.ParseAttributes(a.AnalyzeAttributes(), c);
     this.ParseContent(a, c);
 }
コード例 #4
0
        public static bool TryParseElementEntry <T>(this XmlModelElementAnalyzer elementAnalyzer, string elementName, XmlDocParsingContext context, out T result)
            where T : XmlElementModelItem, new()
        {
            bool ok;
            XmlModelElementAnalyzer el;

            if (elementAnalyzer.TryGetElement(elementName, out el))
            {
                result = new T();
                result.Parse(el, context);
                ok = true;
            }
            else
            {
                result = null;
                ok     = false;
            }

            return(ok);
        }
コード例 #5
0
        public static bool TryParseEntries <T>(this XmlModelElementAnalyzer elementAnalyzer, int minOccurs, int maxOccurs, XmlDocParsingContext context, TryEntryHandlerDelegate <T> handler, out T[] result)
        {
            List <T> lst = new List <T>();
            T        item;
            Int32    count = 0;

            for (; count < minOccurs; count++)
            {
                if (handler(elementAnalyzer, context, out item))
                {
                    lst.Add(item);
                }
                else
                {
                    result = null;
                    return(false);
                }
            }

            for (; count < maxOccurs; count++)
            {
                if (handler(elementAnalyzer, context, out item))
                {
                    lst.Add(item);
                }
                else
                {
                    break;
                }
            }

            result = lst.ToArray();
            return(true);
        }
コード例 #6
0
 public static bool TryParseElementEntries <T>(this XmlModelElementAnalyzer elementAnalyzer, string elementName, int minOccurs, int maxOccurs, XmlDocParsingContext context, out T[] result)
     where T : XmlElementModelItem, new()
 {
     return(elementAnalyzer.TryParseEntries(minOccurs, maxOccurs, context, new TryParseElementEntriesHandlerContext(elementName).Proc <T>, out result));
 }
コード例 #7
0
 public bool Proc <T>(XmlModelElementAnalyzer elementAnalyzer, XmlDocParsingContext context, out T result)
     where T : XmlElementModelItem, new()
 {
     return(elementAnalyzer.TryParseElementEntry(_elementName, context, out result));
 }