private Unit HandleEndElement(XmlTextReader reader, IObserver <SaxEvent> observer, string[] path) { var content = _contentHolder.GetContent(); var startElement = _contentHolder.StartSaxEvent; _contentHolder = _contentHolder.Parent; var strUri = reader.NamespaceURI; var strName = reader.Name; var endElementEvent = new EndElementEvent(strUri, strName, false, startElement.Attributes, content, path); _contentHolder.Append(endElementEvent); observer.OnNext(endElementEvent); return(Unit.Default); }
private Unit HandleStartElement(XmlTextReader reader, IObserver <SaxEvent> observer, string[] path) { var attributes = new Dictionary <string, string>(); var strUri = reader.NamespaceURI; var strName = reader.Name; var isClosed = reader.IsEmptyElement; if (reader.HasAttributes) { for (var i = 0; i < reader.AttributeCount; i++) { reader.MoveToAttribute(i); attributes.Add(reader.Name, reader.Value); } } var startElementEvent = new StartElementEvent(strUri, strName, isClosed, new ReadOnlyDictionary <string, string>(attributes), path); _contentHolder = new ContentHolder(startElementEvent, _contentHolder); observer.OnNext(startElementEvent); return(Unit.Default); }
public SaxParser() { _contentHolder = new ContentHolder(); }
public ContentHolder(StartElementEvent startSaxEvent, ContentHolder parent) { _content = new List <SaxEvent>(); Parent = parent; StartSaxEvent = startSaxEvent; }