Ejemplo n.º 1
0
        public IEnumerable <XmlScanner> Read()
        {
            if (this._leave)
            {
                yield break;
            }
            if (!this._enter)
            {
                bool empty;

                this._enter = true;
                empty       = this._reader.NodeType != XmlNodeType.Element;
                if (this._reader.IsEmptyElement)
                {
                    empty = true;
                }
                this.ReadInternal();
                if (empty)
                {
                    this._leave = true;
                    yield break;
                }
            }
            while (true)
            {
                int depth;

                depth = this._reader.Depth - this._depth;
                if (depth < 1)
                {
                    this._leave = true;
                    yield break;
                }
                if (depth == 1)
                {
                    XmlScanner scanner;

                    scanner = new XmlScanner(this);
                    yield return(scanner);

                    scanner.Skip();
                    continue;
                }
                throw new InvalidProgramException();
            }
        }
Ejemplo n.º 2
0
 private XmlScanner(
     XmlScanner parent,
     XmlReader reader,
     bool close)
 {
     this._parent = parent;
     this._reader = reader;
     this._close  = close;
     if (reader.ReadState == ReadState.Initial)
     {
         this.ReadInternal();
     }
     this._depth      = this._reader.Depth;
     this._nodeType   = this._reader.NodeType;
     this._name       = this._reader.Name;
     this._attributes = this.ReadAttributes();
     this._value      = this.ReadValue();
     this._enter      = false;
     this._leave      = false;
 }
Ejemplo n.º 3
0
 public XmlScanner(Stream stream)
     : this(stream, XmlScanner.CreateReaderSettings())
 { /* do nothing */
 }
Ejemplo n.º 4
0
 private XmlScanner(XmlScanner scanner)
     : this(scanner, scanner._reader, false)
 { /* do nothing */
 }