System.Xml.Xsl.XsltOld.ReaderOutput.Read C# (CSharp) Method

Read() public method

public Read ( ) : bool
return bool
        public override bool Read() {
            Debug.Assert(this.processor != null || this.state == ReadState.Closed);

            if (this.state != ReadState.Interactive) {
                if (this.state == ReadState.Initial) {
                    state = ReadState.Interactive;
                }
                else {
                    return false;
                }
            }

            while (true) { // while -- to ignor empty whitespace nodes.
                if (this.haveRecord) {
                    this.processor.ResetOutput();
                    this.haveRecord = false;
                }

                this.processor.Execute();

                if (this.haveRecord) {
                    CheckCurrentInfo();
                    // check text nodes on whitespaces;
                    switch (this.NodeType) {
                    case XmlNodeType.Text :
                        if (xmlCharType.IsOnlyWhitespace(this.Value)) {
                            this.currentInfo.NodeType = XmlNodeType.Whitespace;
                            goto case XmlNodeType.Whitespace;
                        }
                        Debug.Assert(this.Value.Length != 0, "It whould be Whitespace in this case");
                        break;
                    case XmlNodeType.Whitespace :
                        if(this.Value.Length == 0) {
                            continue;                          // ignoring emty text nodes
                        }
                        if (this.XmlSpace == XmlSpace.Preserve) {
                            this.currentInfo.NodeType = XmlNodeType.SignificantWhitespace;
                        }
                        break;
                    }                
                }
                else {
                    Debug.Assert(this.processor.ExecutionDone);
                    this.state = ReadState.EndOfFile;
                    Reset();
                }

                return this.haveRecord;
            }
        }