protected void ParseContent(StringStream stream) { if (stream.GetChar() == LEFTBRACE) { // Node content if (stream.IsNext(ENDNODE)) { // End node stream.ExtractUntil(true, RIGHTBRACE); // Skip to end return; } else if (stream.IsNext(COMMENT)) { // Comment stream.ExtractUntil(ENDCOMMENT, true); } else { XMLNode subNode = new XMLNode(this); if (!subNode.Parse(stream)) { // Error parsing. Stop return; } Add(subNode); } } else { // Text content Content = stream.ExtractUntil(false, LEFTBRACE); } // Parse rest of content ParseContent(stream); }