public FileParserController(ILogger <FileParserController> logger, IXmlHandler xmlHandler, IJsonHandler jsonHandler, IEmailSender emailSender) { _logger = logger; _xmlHandler = xmlHandler; _jsonHandler = jsonHandler; _emailSender = emailSender; }
/// <summary>添加处理器</summary> /// <param name="handler"></param> /// <returns></returns> public Xml AddHandler(IXmlHandler handler) { if (handler != null) { handler.Host = this; Handlers.Add(handler); // 根据优先级排序 Handlers.Sort(); } return(this); }
/// <summary>添加处理器</summary> /// <param name="handler"></param> /// <returns></returns> public Xml AddHandler(IXmlHandler handler) { if (handler != null) { handler.Host = this; Handlers.Add(handler); // 根据优先级排序 Handlers = Handlers.OrderBy(e => e.Priority).ToList(); } return(this); }
private void Cleanup() { line = 1; column = 0; xmlHandler_ = null; textReader_ = null; elementNames_.Clear(); xmlSpaces_.Clear(); _attributes.Clear(); stringBuffer_.Length = 0; xmlBlank_ = null; isBlank_ = false; }
public XmlForm(IModelExport <MovieModel> modelExport, IXmlHandler <MovieModel> xmlHandler, IFilterControlCreatorFactory <MovieModel> filterCreatorFactory, IEnumerable <IFilter <MovieModel> > filters, IControlCreator <MovieModel, Panel> modelControlCreator) { _xmlHandler = xmlHandler; _modelExport = modelExport; _modelControlCreator = modelControlCreator; _filterCreatorFactory = filterCreatorFactory; _filtersDictionary = new Dictionary <IFilter <MovieModel>, IControlCreator <MovieModel, TabPage> >(); filters.ToList().ForEach(x => _filtersDictionary.Add(x, this._filterCreatorFactory.Get(x))); _filterControlCreator = _filtersDictionary.Values; InitializeComponent(); ShowLoadedFilters(_filtersDictionary.Keys.ToList().CallOnEach(x => x.FilterName + ".dll")); }
public void Parse(TextReader input, IXmlHandler handler) { this.textReader_ = input; this.xmlHandler_ = handler; handler.OnStartParsing(this); while (PeekNext_() >= 0) { ReadAll(); } HandleBufferContent_(); if (elementNames_.Count > 0) { throw ErrorMsg_(String.Format("Insufficient close tag: {0}", elementNames_.Peek())); } handler.OnEndParsing(this); Cleanup(); }
/// <summary> /// Reads all nodes in an XML file, and calls the methods from the supplied IXmlHandler derivative. /// A generic type parameter is required to specify which data type the IXmlHandler will be returning. /// This method will return that object as the return value. /// </summary> public static DataType ReadFromXml <DataType>(string path, IXmlHandler <DataType> handler) { XmlTextReader read = new XmlTextReader(new FileStream(path, FileMode.Open)); while (read.Read()) { switch (read.NodeType) { case XmlNodeType.Document: handler.StartDocument(); break; case XmlNodeType.Element: string nsURI = read.NamespaceURI; string lName = read.LocalName; string name = read.Name; XmlAttributes attribs = new XmlAttributes(); while (read.MoveToNextAttribute()) { attribs.Add(read.Name, read.Value); } handler.StartElement(nsURI, lName, name, attribs); break; case XmlNodeType.EndElement: handler.EndElement(read.NamespaceURI, read.LocalName, read.Name); break; case XmlNodeType.Text: handler.Text(read.Value); break; } } handler.EndDocument(); return(handler.Get()); }
public StoneRepository(IXmlHandler xmlHandler) { this.xmlHandler = xmlHandler; }
public Logic(IXmlHandler xmlHandler) { _xmlHandler = xmlHandler; }