Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public SaxParser()
 {
     _contentHolder = new ContentHolder();
 }
Ejemplo n.º 4
0
 public ContentHolder(StartElementEvent startSaxEvent, ContentHolder parent)
 {
     _content      = new List <SaxEvent>();
     Parent        = parent;
     StartSaxEvent = startSaxEvent;
 }