System.Xml.XmlNodeReaderImpl.XmlNodeReaderImpl.ReadContent C# (CSharp) Méthode

ReadContent() private méthode

private ReadContent ( ) : bool
Résultat bool
		bool ReadContent ()
		{
			if (ReadState == ReadState.Initial) {
				current = startNode;
				state = ReadState.Interactive;
				// when startNode is document or fragment
				if (ignoreStartNode)
					current = startNode.FirstChild;
				if (current == null) {
					state = ReadState.Error;
					return false;
				} else
					return true;
			}

			MoveToElement ();

			// don't step into EntityReference's children. Also
			// avoid re-entering children of already-consumed
			// element (i.e. when it is regarded as EndElement).
			XmlNode firstChild =
				!isEndElement && current.NodeType != XmlNodeType.EntityReference ?
				current.FirstChild : null;
			if (firstChild != null) {
				isEndElement = false;
				current = firstChild;
				depth++;
				return true;
			}

			if (current == startNode) { // Currently it is on the start node.
				if (IsEmptyElement || isEndElement) {
					// The start node is already consumed.
					isEndElement = false;
					current = null;
					state = ReadState.EndOfFile;
					return false;
				} else {
					// The start node is the only element
					// which should be processed. Now it
					// is set as EndElement.
					isEndElement = true;
					return true;
				}
			}
			if (!isEndElement && !IsEmptyElement &&
			    current.NodeType == XmlNodeType.Element) {
				// element, currently not EndElement, and has
				// no child. (such as <foo></foo>, which
				// should become EndElement).
				isEndElement = true;
				return true;
			}

			// If NextSibling is available, move to there.
			XmlNode next = current.NextSibling;
			if (next != null) {
				isEndElement = false;
				current = next;
				return true;
			}

			// Otherwise, parent.
			XmlNode parent = current.ParentNode;
			if (parent == null || parent == startNode && ignoreStartNode) {
				// Parent is not available, or reached to
				// the start node. This reader never sets 
				// startNode as current if it was originally 
				// ignored (e.g. startNode is XmlDocument).
				isEndElement = false;
				current = null;
				state = ReadState.EndOfFile;
				return false;
			} else {
				// Parent was available, so return it as
				// EndElement.
				current = parent;
				depth--;
				isEndElement = true;
				return true;
			}
		}