Parses an attribute value. The current position should be the first non-whitespace character following the equal sign. We terminate the name or value if we encounter a new line. This seems to be the best way of handling errors such as values missing closing quotes, etc. Returns the parsed value string.
()
| 299 | /// <remarks>We terminate the name or value if we encounter a new line. This seems to be the best way of handling errors such as values missing closing quotes, etc.</remarks> |
| 300 | /// <returns>Returns the parsed value string.</returns> |
| 301 | private string ParseAttributeValue() |
| 302 | { |
| 303 | int start, end; |
| 304 | char c = Peek(); |
| 305 | if (c == '"' || c == '\'') |
| 306 | { |
| 307 | // Move past opening quote |
| 308 | Move(); |
| 309 | |
| 310 | // Parse quoted value |
| 311 | start = _pos; |
| 312 | _newLineChars[0] = c; |
| 313 | _pos = _html.IndexOfAny(_newLineChars, start); |
| 314 | NormalizePosition(); |
| 315 | end = _pos; |
| 316 | |
| 317 | // Move past closing quote |
| 318 | if (Peek() == c) |
| 319 | Move(); |
| 320 | } |
| 321 | else |
| 322 | { |
| 323 | // Parse unquoted value |
| 324 | start = _pos; |
| 325 | while (!EOF && !char.IsWhiteSpace(c) && c != '>' && c != '/') |
| 326 | { |
| 327 | Move(); |
| 328 | c = Peek(); |
| 329 | } |
| 330 | end = _pos; |
| 331 | } |
| 332 | return _html.Substring(start, end - start); |
| 333 | } |
| 334 | |
| 335 | /// <summary> |
| 336 | /// Moves to the start of the next tag. |
nothing calls this directly
no test coverage detected