protected abstract void ParseContent(XmlModelElementAnalyzer a, XmlDocParsingContext c);
protected abstract void ParseAttributes(XmlModelAttributesAnalyzer a, XmlDocParsingContext c);
public void Parse(XmlModelElementAnalyzer a, XmlDocParsingContext c) { this.ParseAttributes(a.AnalyzeAttributes(), c); this.ParseContent(a, c); }
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); }
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); }
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)); }
public bool Proc <T>(XmlModelElementAnalyzer elementAnalyzer, XmlDocParsingContext context, out T result) where T : XmlElementModelItem, new() { return(elementAnalyzer.TryParseElementEntry(_elementName, context, out result)); }