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

ReadString() public method

public ReadString ( ) : string
return string
        public override string ReadString() {
            string result = string.Empty;

            if (NodeType == XmlNodeType.Element || NodeType == XmlNodeType.Attribute || this.currentInfo == this.attributeValue) {
                if(this.mainNode.IsEmptyTag) {
                    return result;
                }
                if (! Read()) {
                    throw new InvalidOperationException(Res.GetString(Res.Xml_InvalidOperation));
                }
            }

            StringBuilder   sb    = null;
            bool            first = true;

            while(true) {
                switch (NodeType) {
                case XmlNodeType.Text:
                case XmlNodeType.Whitespace:
                case XmlNodeType.SignificantWhitespace:
//              case XmlNodeType.CharacterEntity:
                    if (first) {
                        result = this.Value;
                        first = false;
                    } else {
                        if (sb == null) {
                            sb = new StringBuilder(result);
                        }
                        sb.Append(this.Value);
                    }
                    if (! Read())
                        throw new InvalidOperationException(Res.GetString(Res.Xml_InvalidOperation));
    		        break;
                default:
                    return (sb == null) ? result : sb.ToString();
                }
            }
        }