1 write to _ps
System.Private.Xml (1)
System\Xml\Core\XmlTextReaderImpl.cs (1)
8160_ps = _parsingStatesStack[_parsingStatesStackTop--];
1705 references to _ps
System.Private.Xml (1705)
System\Xml\Core\XmlTextReaderImpl.cs (1053)
352_ps.lineNo = 1; 353_ps.lineStartPos = -1; 414_ps.lineNo = _lineNumberOffset + 1; 415_ps.lineStartPos = -_linePositionOffset - 1; 416_curNode.SetLineInfo(_ps.LineNo - 1, _ps.LinePos - 1); 476_reportedBaseUri = _ps.baseUriStr; 477_reportedEncoding = _ps.encoding; 500_reportedEncoding = _ps.encoding; 523_reportedBaseUri = _ps.baseUriStr; 524_reportedEncoding = _ps.encoding; 545_reportedEncoding = _ps.encoding; 576_ps.baseUri = GetTempResolver().ResolveUri(null, url); 577_ps.baseUriStr = _ps.baseUri.ToString(); 578_reportedBaseUri = _ps.baseUriStr; 664_reportedEncoding = _ps.encoding; 744_reportedEncoding = _ps.encoding; 797_reportedEncoding = _ps.encoding; 815_reportedBaseUri = _ps.baseUriStr; 816_reportedEncoding = _ps.encoding; 1238Debug.Assert(!_ps.appendMode); 1247_reportedEncoding = _ps.encoding; 1250_reportedEncoding = _ps.encoding; 1287_reportedEncoding = _ps.encoding; 1288_reportedBaseUri = _ps.baseUriStr; 1294_curNode.SetLineInfo(_ps.lineNo, _ps.LinePos); 1295_reportedEncoding = _ps.encoding; 1296_reportedBaseUri = _ps.baseUriStr; 1468_attributeValueBaseEntityId = _ps.entityId; 1473if (_ps.entityId == _attributeValueBaseEntityId) 1509if (_ps.charsUsed - _ps.charPos == 0) 1530if (_ps.charsUsed - _ps.charPos == 0 && !_ps.entity!.IsExternal) 1548_ps.entityResolvedManually = true; 1868Debug.Assert(_ps.chars != null); 1869BlockCopyChars(_ps.chars, startPos, buffer, (index + readCount), copyCount); 1892Debug.Assert(_ps.chars != null); 1893_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 2021if (_ps.entity == null || _ps.entity.IsExternal) 2023_ps.eolNormalized = !value; 2112_ps.baseUri = null; 2179_stringBuilder.Append(_ps.chars, _incReadLeftStartPos, _incReadLeftEndPos - _incReadLeftStartPos); 2189_ps.appendMode = false; 2192_stringBuilder.Append(_ps.chars, _ps.charPos, _ps.charsUsed - _ps.charPos); 2193_ps.charPos = _ps.charsUsed; 2364if (_ps.baseUriStr.Length > 0 && _ps.baseUri == null && _xmlResolver != null) 2366_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2369return _ps.baseUri; 2377return _ps.isEof; 2385return _ps.chars; 2393return _ps.charsUsed; 2401return _ps.charPos; 2405Debug.Assert(value >= 0 && value <= _ps.charsUsed); 2406_ps.charPos = value; 2422return _ps.eolNormalized; 2447return _ps.LineNo; 2455return _ps.lineStartPos; 2515if (e.ResString == SR.Xml_UnexpectedEOF && _ps.entity != null) 2517SendValidationEvent(XmlSeverityType.Error, SR.Sch_ParEntityRefNesting, null, _ps.LineNo, _ps.LinePos); 2556entityId = _ps.entityId; 2569oldEntity = _ps.entity; 2571newEntityId = _ps.entityId; 2589if (_ps.baseUri == null && !string.IsNullOrEmpty(_ps.baseUriStr)) 2591_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2594PushExternalEntityOrSubset(publicId, systemId, _ps.baseUri, null); 2596_ps.entity = null; 2597_ps.entityId = 0; 2599Debug.Assert(_ps.appendMode); 2600int initialPos = _ps.charPos; 2607_ps.charPos = initialPos; 2623_ps.entity = null; 2624_ps.entityId = 0; 2625_ps.eolNormalized = false; 2656_ps.charPos = pos; 2663_ps.charPos = pos; 2670_ps.charPos = pos; 2683Throw(new XmlException(res, string.Empty, lineNo, linePos, _ps.baseUriStr)); 2689Throw(new XmlException(res, arg, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2695Throw(new XmlException(res, arg, lineNo, linePos, _ps.baseUriStr)); 2701Throw(new XmlException(res, args, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2713Throw(new XmlException(res, args, innerException, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2733Throw(new XmlException(e.Message, (Exception?)null, lineNo, linePos, _ps.baseUriStr)); 2739Throw(new XmlException(res, string.Empty, _ps.baseUriStr)); 2745Throw(new XmlException(res, arg, _ps.baseUriStr)); 2751Throw(new XmlException(res, args, innerException, 0, 0, _ps.baseUriStr)); 2768SendValidationEvent(severity, new XmlSchemaException(code, arg, _ps.baseUriStr, lineNo, linePos)); 2801while (_ps.entityId != _attributeValueBaseEntityId) 2843Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 2847_ps.stream = stream; 2848_ps.baseUri = baseUri; 2849_ps.baseUriStr = baseUriStr; 2855_ps.bytes = bytes; 2856_ps.bytesUsed = byteCount; 2857bufferSize = _ps.bytes.Length; 2870if (_ps.bytes == null || _ps.bytes.Length < bufferSize) 2872_ps.bytes = new byte[bufferSize]; 2877if (_ps.chars == null || _ps.chars.Length < bufferSize + 1) 2879_ps.chars = new char[bufferSize + 1]; 2883_ps.bytePos = 0; 2884if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0) 2886int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed); 2887int read = stream.ReadAtLeast(_ps.bytes.AsSpan(_ps.bytesUsed), bytesToRead, throwOnEndOfStream: false); 2890_ps.isStreamEof = true; 2892_ps.bytesUsed += read; 2902_documentStartBytePos = _ps.bytePos; 2904_ps.eolNormalized = !_normalize; 2907_ps.appendMode = true; 2918Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 2921_ps.textReader = input; 2922_ps.baseUriStr = baseUriStr; 2923_ps.baseUri = baseUri; 2925if (_ps.chars == null) 2929_ps.chars = new char[XmlReader.AsyncBufferSize + 1]; 2933_ps.chars = new char[XmlReader.DefaultBufferSize + 1]; 2937_ps.encoding = Encoding.Unicode; 2938_ps.eolNormalized = !_normalize; 2941_ps.appendMode = true; 2947Debug.Assert(_ps.stream == null && _ps.textReader == null); 2948Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0); 2952_ps.baseUriStr = baseUriStr; 2953_ps.baseUri = null; 2956_ps.chars = new char[len + 1]; 2957str.CopyTo(0, _ps.chars, 0, str.Length); 2958_ps.charsUsed = len; 2959_ps.chars[len] = (char)0; 2961_ps.encoding = originalEncoding; 2963_ps.eolNormalized = !_normalize; 2964_ps.isEof = true; 2983_ps.baseUriStr = parserContext.BaseURI; 2984_ps.baseUri = null; 2991_ps.baseUriStr = string.Empty; 2992_ps.baseUri = null; 2995_reportedBaseUri = _ps.baseUriStr; 3000_ps.appendMode = false; 3015_ps.appendMode = false; 3061if (_ps.baseUri == null) 3063_ps.baseUri = tmpResolver.ResolveUri(null, _url); 3064_ps.baseUriStr = _ps.baseUri.ToString(); 3069_ps.stream = (Stream?)tmpResolver.GetEntity(_ps.baseUri, null, typeof(Stream)); 3077if (_ps.stream == null) 3079ThrowWithoutLineInfo(SR.Xml_CannotResolveUrl, _ps.baseUriStr); 3082Debug.Assert(_ps.stream != null); 3083InitStreamInput(_ps.baseUri, _ps.baseUriStr, _ps.stream, null); 3084_reportedEncoding = _ps.encoding; 3090Debug.Assert(_ps.bytes != null); 3091Debug.Assert(_ps.bytePos == 0); 3093if (_ps.bytesUsed < 2) 3098int first2Bytes = _ps.bytes[0] << 8 | _ps.bytes[1]; 3099int next2Bytes = (_ps.bytesUsed >= 4) ? (_ps.bytes[2] << 8 | _ps.bytes[3]) : 0; 3177Debug.Assert(_ps.charPos == 0); 3178_ps.encoding = Encoding.UTF8; 3179_ps.decoder = new SafeAsciiDecoder(); 3183_ps.encoding = encoding; 3184_ps.decoder = _ps.encoding.WebName switch // Encoding.Codepage is not supported in Silverlight 3195Debug.Assert(_ps.encoding != null); 3196Debug.Assert(_ps.bytes != null); 3197ReadOnlySpan<byte> preamble = _ps.encoding.Preamble; 3198if (_ps.bytes.AsSpan(0, _ps.bytesUsed).StartsWith(preamble)) 3200_ps.bytePos = preamble.Length; 3207Debug.Assert(_ps.encoding != null); 3208if ((newEncoding.WebName != _ps.encoding.WebName || _ps.decoder is SafeAsciiDecoder) && !_afterResetState) 3210Debug.Assert(_ps.stream != null); 3212_ps.appendMode = false; 3222Debug.Assert(_ps.encoding != null); 3225if (_ps.stream == null) 3227return _ps.encoding; 3235if (_ps.encoding.WebName != "utf-16BE" && 3236_ps.encoding.WebName != "utf-16" && 3248return _ps.encoding; 3276if (_afterResetState && _ps.encoding.WebName != newEncoding.WebName) 3286Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3287Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false"); 3289Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range."); 3297Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos, 3299_charactersInDocument -= _ps.charsUsed - _ps.charPos; 3306Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos, 3308_charactersFromEntities -= _ps.charsUsed - _ps.charPos; 3312_ps.bytePos = _documentStartBytePos; // byte position after preamble 3313if (_ps.charPos > 0) 3315Debug.Assert(_ps.encoding != null); 3316Debug.Assert(_ps.chars != null); 3317if (_ps.decoder is SafeAsciiDecoder) 3324_ps.bytePos += _ps.charPos; 3325int encodingByteCount = _ps.encoding.GetByteCount(_ps.chars, 0, _ps.charPos); 3326if (encodingByteCount != _ps.charPos) 3333_ps.bytePos += _ps.encoding.GetByteCount(_ps.chars, 0, _ps.charPos); 3337_ps.charsUsed = _ps.charPos; 3338_ps.isEof = false; 3354if (_ps.isEof) 3359Debug.Assert(_ps.chars != null); 3361if (_ps.appendMode) 3364if (_ps.charsUsed == _ps.chars.Length - 1) 3387char[] newChars = new char[_ps.chars.Length * 2]; 3388BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3389_ps.chars = newChars; 3392if (_ps.stream != null) 3395if (_ps.bytesUsed - _ps.bytePos < MaxByteSequenceLen) 3397Debug.Assert(_ps.bytes != null); 3398if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen) 3400byte[] newBytes = new byte[_ps.bytes.Length * 2]; 3401BlockCopy(_ps.bytes, 0, newBytes, 0, _ps.bytesUsed); 3402_ps.bytes = newBytes; 3407charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3415int charsLen = _ps.chars.Length; 3416if (charsLen - _ps.charsUsed <= charsLen / 2) 3440int copyCharsCount = _ps.charsUsed - _ps.charPos; 3443_ps.lineStartPos -= _ps.charPos; 3446BlockCopyChars(_ps.chars, _ps.charPos, _ps.chars, 0, copyCharsCount); 3448_ps.charPos = 0; 3449_ps.charsUsed = copyCharsCount; 3453char[] newChars = new char[_ps.chars.Length * 2]; 3454BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3455_ps.chars = newChars; 3459if (_ps.stream != null) 3462int bytesLeft = _ps.bytesUsed - _ps.bytePos; 3467_ps.bytesUsed = 0; 3471Debug.Assert(_ps.bytes != null); 3472BlockCopy(_ps.bytes, _ps.bytePos, _ps.bytes, 0, bytesLeft); 3473_ps.bytesUsed = bytesLeft; 3476_ps.bytePos = 0; 3479charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3482if (_ps.stream != null) 3484if (!_ps.isStreamEof) 3486Debug.Assert(_ps.bytes != null); 3489if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0) 3491int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed); 3494_ps.isStreamEof = true; 3496_ps.bytesUsed += read; 3500int originalBytePos = _ps.bytePos; 3504if (charsRead == 0 && _ps.bytePos != originalBytePos) 3510else if (_ps.textReader != null) 3513charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1); 3514_ps.charsUsed += charsRead; 3525Debug.Assert(_ps.charsUsed < _ps.chars.Length); 3526_ps.isEof = true; 3529_ps.chars[_ps.charsUsed] = (char)0; 3536Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3537Debug.Assert(_ps.chars != null); 3538Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1); 3541int bytesCount = _ps.bytesUsed - _ps.bytePos; 3552_ps.decoder.Convert(_ps.bytes, _ps.bytePos, bytesCount, _ps.chars, _ps.charsUsed, maxCharsCount, false, out bytesCount, out charsCount, out completed); 3560_ps.bytePos += bytesCount; 3561_ps.charsUsed += charsCount; 3577Debug.Assert(_ps.decoder != null); 3578Debug.Assert(_ps.bytes != null); 3579Debug.Assert(_ps.chars != null); 3580_ps.decoder.Convert(_ps.bytes, _ps.bytePos + bytesDecoded, 1, _ps.chars, _ps.charsUsed + charsDecoded, 2, false, out bDec, out chDec, out completed); 3593Throw(_ps.charsUsed, SR.Xml_InvalidCharInThisEncoding); 3612_ps.Close(closeInput); 3627Debug.Assert(_ps.chars != null); 3628BlockCopyChars(_ps.chars, sourcePos, _ps.chars, destPos, count); 3634while (_ps.charsUsed - _ps.charPos < 6) 3642if (!_ps.chars.AsSpan(_ps.charPos).StartsWith(XmlDeclarationBeginning) || 3643XmlCharType.IsNameSingleChar(_ps.chars![_ps.charPos + 5])) 3650_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos + 2); 3654_ps.charPos += 5; 3670if (_ps.chars[_ps.charPos] == '?') 3674if (_ps.chars[_ps.charPos + 1] == '>') 3681_ps.charPos += 2; 3701Debug.Assert(_ps.encoding != null); 3702string encodingName = _ps.encoding.WebName; 3704encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3706Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3709if (_ps.decoder is SafeAsciiDecoder) 3718_ps.appendMode = false; 3721else if (_ps.charPos + 1 == _ps.charsUsed) 3740switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 3779attr.SetLineInfo(_ps.LineNo, _ps.LinePos); 3781sb.Append(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 3782_ps.charPos = nameEndPos; 3785if (_ps.chars[_ps.charPos] != '=') 3788if (_ps.chars[_ps.charPos] != '=') 3794_ps.charPos++; 3796char quoteChar = _ps.chars[_ps.charPos]; 3800quoteChar = _ps.chars[_ps.charPos]; 3807_ps.charPos++; 3812attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 3816int pos = _ps.charPos; 3819chars = _ps.chars; 3825if (_ps.chars[pos] == quoteChar) 3832if (_ps.chars.AsSpan(_ps.charPos).StartsWith("1.0")) 3837attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3843string badVersion = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3848string encName = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3858switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 3868Throw(SR.Xml_InvalidXmlDecl, _ps.LineNo, _ps.LinePos - 1); 3874attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3882sb.Append(chars, _ps.charPos, pos - _ps.charPos); 3884_ps.charPos = pos + 1; 3887else if (pos == _ps.charsUsed) 3904if (_ps.isEof || ReadData() == 0) 3919Debug.Assert(_ps.encoding != null); 3920string encodingName = _ps.encoding.WebName; 3922encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3924Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3927if (_ps.decoder is SafeAsciiDecoder) 3931_ps.appendMode = false; 3942int pos = _ps.charPos; 3943Debug.Assert(_ps.chars != null); 3944char[] chars = _ps.chars; 3950if (_ps.charsUsed - pos < 4) // minimum "<a/>" 3957_ps.charPos = pos + 1; 3965if (_ps.charsUsed - pos < 2) // minimum characters expected "--" 3972_ps.charPos = pos + 2; 3990if (_ps.charsUsed - pos < 6) 3996_ps.charPos = pos + 6; 4011Throw(_ps.charPos, SR.Xml_InvalidRootData); 4020_ps.charPos = pos; 4056_ps.charPos = pos; 4097else if (pos == _ps.charsUsed || ((_v1Compat || mangoQuirks) && chars[pos] == 0x0)) 4125Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 4167int pos = _ps.charPos; 4168Debug.Assert(_ps.chars != null); 4169char[] chars = _ps.chars; 4179_ps.charPos = pos + 2; 4187if (_ps.charsUsed - pos < 2) 4194_ps.charPos = pos + 2; 4210if (_ps.charsUsed - pos < 6) 4216_ps.charPos = pos + 6; 4239_ps.charPos = pos + 2; 4244if (pos + 1 == _ps.charsUsed) 4251_ps.charPos = pos + 1; 4265if (pos == _ps.charsUsed) 4284if (_ps.charsUsed - _ps.charPos != 0) 4310Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF1); 4334Throw(_ps.charsUsed, SR.Xml_UnexpectedEOFInElementContent, _stringBuilder.ToString()); 4341int pos = _ps.charPos; 4342Debug.Assert(_ps.chars != null); 4343char[] chars = _ps.chars; 4346_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4397else if (pos + 1 < _ps.charsUsed) 4404chars = _ps.chars; 4415_nameTable.Add(chars, _ps.charPos, pos - _ps.charPos)); 4419int startPos = _ps.charPos; 4432_nameTable.Add(chars, _ps.charPos, prefixLen), 4443_ps.charPos = pos; 4453_ps.charPos = pos + 1; 4459if (pos + 1 == _ps.charsUsed) 4461_ps.charPos = pos; 4466pos = _ps.charPos; 4467chars = _ps.chars; 4474_ps.charPos = pos + 2; 4484Throw(pos, SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4584while (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 4593Debug.Assert(_ps.chars != null); 4594char[] chars = _ps.chars; 4597if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.localName)) 4605int colonPos = _ps.charPos + prefLen; 4606if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.prefix) || 4615LineInfo endTagLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 4620pos = _ps.charPos + nameLen; 4621chars = _ps.chars; 4623if (pos == _ps.charsUsed) 4650else if (pos == _ps.charsUsed && !_ps.isEof) 4664else if (pos == _ps.charsUsed) 4690_ps.charPos = pos + 1; 4704Debug.Assert(_ps.chars != null); 4709args[3] = new string(_ps.chars, _ps.charPos, endPos - _ps.charPos); 4722int pos = _ps.charPos; 4723Debug.Assert(_ps.chars != null); 4724char[] chars = _ps.chars; 4749else if (pos + 1 != _ps.charsUsed) 4756_ps.charPos = pos; 4777_ps.charPos = pos + 1; 4785if (pos + 1 == _ps.charsUsed) 4791_ps.charPos = pos + 2; 4802else if (pos == _ps.charsUsed) 4808Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4812if (pos == _ps.charPos) 4816_ps.charPos = pos; 4819int attrNameLinePos = _ps.LinePos; 4875chars = _ps.chars; 4878else if (pos + 1 >= _ps.charsUsed) 4881chars = _ps.chars; 4885attr.SetLineInfo(_ps.LineNo, attrNameLinePos); 4894_ps.charPos = pos; 4896pos = _ps.charPos; 4907_ps.charPos = pos; 4909pos = _ps.charPos; 4917_ps.charPos = pos; 4920attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 4938attr.SetValue(chars, _ps.charPos, pos - _ps.charPos); 4940_ps.charPos = pos; 4945pos = _ps.charPos; 4946chars = _ps.chars; 4974_ps.lineNo -= lineNoDelta; 4977pos = _ps.charPos; 4978chars = _ps.chars; 5137Debug.Assert(_ps.chars != null); 5138char[] chars = _ps.chars; 5139int attributeBaseEntityId = _ps.entityId; 5141LineInfo valueChunkLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 5154if (pos - _ps.charPos > 0) 5156_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5157_ps.charPos = pos; 5160if (chars[pos] == quoteChar && attributeBaseEntityId == _ps.entityId) 5175_ps.charPos++; 5184_stringBuilder.Append(_ps.eolNormalized ? "\u0020\u0020" : "\u0020"); // CDATA normalization of 0xD 0xA 5185_ps.charPos = pos; 5188else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5194_ps.charPos = pos; 5209_ps.charPos++; 5223if (pos - _ps.charPos > 0) 5225_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5227_ps.charPos = pos; 5229int enclosingEntityId = _ps.entityId; 5230LineInfo entityLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos + 1); 5238if (_parsingMode == ParsingMode.Full && _ps.entityId == attributeBaseEntityId) 5252_ps.charPos++; 5269valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5275_ps.charPos++; 5278pos = _ps.charPos; 5299Debug.Assert(_ps.entity != null); 5300entityChunk.SetNamedNode(XmlNodeType.EntityReference, _ps.entity.Name); 5308pos = _ps.charPos; 5311pos = _ps.charPos; 5314chars = _ps.chars; 5318if (pos == _ps.charsUsed) 5328if (pos + 1 == _ps.charsUsed) 5339ThrowInvalidChar(chars, _ps.charsUsed, pos); 5349if (_ps.charsUsed - _ps.charPos > 0) 5351if (_ps.chars[_ps.charPos] != (char)0xD) 5356Debug.Assert(_ps.isEof); 5364if (attributeBaseEntityId != _ps.entityId) 5378if (attributeBaseEntityId == _ps.entityId) 5381valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5386pos = _ps.charPos; 5387chars = _ps.chars; 5404_ps.charPos = pos + 1; 5442_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5460Debug.Assert(_ps.chars != null); 5461_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 5474_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5480_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5505Debug.Assert(_ps.chars != null); 5506_curNode.SetValueNode(XmlNodeType.Text, _ps.chars, startPos, endPos - startPos); 5515_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5522_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5580Debug.Assert(_ps.chars != null); 5581char[] chars = _ps.chars; 5582int pos = _ps.charPos; 5610if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 5612if (pos - _ps.charPos > 0) 5628_ps.charPos++; 5633else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5635if (!_ps.eolNormalized) 5673if (pos > _ps.charPos) 5694if (!XmlCharType.IsWhiteSpace(_ps.chars[pos - 1])) 5700pos = _ps.charPos; 5703chars = _ps.chars; 5707if (_ps.charsUsed - pos < 3 && !_ps.isEof) 5720if (pos == _ps.charsUsed) 5730if (pos + 1 == _ps.charsUsed) 5742int offset = pos - _ps.charPos; 5745pos = _ps.charPos + offset; 5750ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos + offset); 5757if (pos > _ps.charPos) 5764if (_ps.charsUsed - _ps.charPos > 0) 5766if (_ps.chars[_ps.charPos] != (char)0xD && _ps.chars[_ps.charPos] != ']') 5770Debug.Assert(_ps.isEof); 5789pos = _ps.charPos; 5790chars = _ps.chars; 5802startPos = _ps.charPos; 5804_ps.charPos = pos; 5823_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5825_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5945Debug.Assert(_ps.chars != null); 5949if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 5956_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5958if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 5970if (XmlCharType.IsCharData(_ps.chars[_ps.charPos])) 5976ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos); 5983Debug.Assert(_ps.chars != null); 5984Debug.Assert(_ps.chars[_ps.charPos] == '&'); 5985_ps.charPos++; 5987_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5993Debug.Assert(_ps.chars != null); 5994Debug.Assert(_ps.chars[_ps.charPos] == '&'); 5996if (_ps.charPos + 1 == _ps.charsUsed) 6005if (_ps.chars[_ps.charPos + 1] == '#') 6033_ps.charPos++; 6034int savedLinePos = _ps.LinePos; 6041Throw(SR.Xml_ErrorParsingEntityName, _ps.LineNo, savedLinePos); 6046if (_ps.chars[endPos] != ';') 6051int entityLinePos = _ps.LinePos; 6052string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 6053_ps.charPos = endPos + 1; 6057_reportedBaseUri = _ps.baseUriStr; 6058_reportedEncoding = _ps.encoding; 6084Throw(SR.Xml_UndeclaredEntity, name, _ps.LineNo, entityStartLinePos); 6098Throw(SR.Xml_UnparsedEntityRef, name, _ps.LineNo, entityStartLinePos); 6103Throw(SR.Xml_ExternalEntityInStandAloneDocument, entity.Name, _ps.LineNo, entityStartLinePos); 6110Throw(SR.Xml_ExternalEntityInAttValue, name, _ps.LineNo, entityStartLinePos); 6124_curNode.entityId = _ps.entityId; 6132_curNode.entityId = _ps.entityId; 6145_curNode.entityId = _ps.entityId; 6167if (_ps.entityResolvedManually) 6173if (_ps.entityId != _nodes[_index].entityId) 6179_lastEntity = _ps.entity; // save last entity for the EndEntity node 6188if (_ps.entityId != _nodes[_index].entityId) 6196_reportedEncoding = _ps.encoding; 6197_reportedBaseUri = _ps.baseUriStr; 6206_reportedEncoding = _ps.encoding; 6207_reportedBaseUri = _ps.baseUriStr; 6212_curNode.lineInfo.Set(_ps.lineNo, _ps.LinePos - 1); 6241_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6248Debug.Assert(_ps.chars != null); 6249string target = _nameTable.Add(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 6255_ps.charPos = nameEndPos; 6270char ch = _ps.chars[_ps.charPos]; 6271Debug.Assert(_ps.charPos < _ps.charsUsed); 6274if (_ps.charsUsed - _ps.charPos < 2) 6278if (ch != '?' || _ps.chars[_ps.charPos + 1] != '>') 6280Throw(SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(_ps.chars, _ps.charsUsed, _ps.charPos)); 6296_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 6301piInDtdStringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6324sb.Append(_ps.chars, startPos, endPos - startPos); 6326sb.Append(_ps.chars, startPos, endPos - startPos); 6341if (_ps.charsUsed - _ps.charPos < 2) 6345Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF, "PI"); 6349Debug.Assert(_ps.chars != null); 6350int pos = _ps.charPos; 6351char[] chars = _ps.chars; 6371Debug.Assert(!_ps.eolNormalized); 6379outStartPos = _ps.charPos; 6380_ps.charPos = pos + 2; 6383else if (pos + 1 == _ps.charsUsed) 6400if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6403if (pos - _ps.charPos > 0) 6419_ps.charPos++; 6424else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6426if (!_ps.eolNormalized) 6446if (pos == _ps.charsUsed) 6456if (pos + 1 == _ps.charsUsed) 6467ThrowInvalidChar(chars, _ps.charsUsed, pos); 6483outStartPos = _ps.charPos; 6484_ps.charPos = pos; 6517_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6521Debug.Assert(_ps.chars != null); 6522_curNode.SetValueNode(type, _ps.chars, startPos, endPos - startPos); 6528_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6531_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6545if (_ps.charsUsed - _ps.charPos < 3) 6554Debug.Assert(_ps.chars != null); 6555int pos = _ps.charPos; 6556char[] chars = _ps.chars; 6578Debug.Assert(!_ps.eolNormalized); 6586outStartPos = _ps.charPos; 6587_ps.charPos = pos + 3; 6590else if (pos + 2 == _ps.charsUsed) 6599else if (pos + 1 == _ps.charsUsed) 6619if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6621if (pos - _ps.charPos > 0) 6637_ps.charPos++; 6642else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6644if (!_ps.eolNormalized) 6664if (pos == _ps.charsUsed) 6672if (pos + 1 == _ps.charsUsed) 6683ThrowInvalidChar(chars, _ps.charsUsed, pos); 6698outStartPos = _ps.charPos; 6700_ps.charPos = pos; 6714while (_ps.charsUsed - _ps.charPos < 8) 6722if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("DOCTYPE")) 6727Debug.Assert(_ps.chars != null); 6728if (!XmlCharType.IsWhiteSpace(_ps.chars[_ps.charPos + 7])) 6730ThrowExpectingWhitespace(_ps.charPos + 7); 6735Throw(_ps.charPos - 2, SR.Xml_MultipleDTDsProvided); // position just before <!DOCTYPE 6740Throw(_ps.charPos - 2, SR.Xml_DtdAfterRootElement); 6743_ps.charPos += 8; 6749_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6786_ps.charPos = pos; 6792Debug.Assert(_ps.chars != null); 6793if (_ps.chars[_ps.charPos] == 'P') 6796while (_ps.charsUsed - _ps.charPos < 6) 6804if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("PUBLIC")) 6808_ps.charPos += 6; 6813ThrowExpectingWhitespace(_ps.charPos); 6822ThrowExpectingWhitespace(_ps.charPos); 6830else if (_ps.chars[_ps.charPos] == 'S') 6833while (_ps.charsUsed - _ps.charPos < 6) 6841if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("SYSTEM")) 6845_ps.charPos += 6; 6850ThrowExpectingWhitespace(_ps.charPos); 6858else if (_ps.chars[_ps.charPos] != '[' && _ps.chars[_ps.charPos] != '>') 6864if (_ps.chars[_ps.charPos] == '[') 6866_ps.charPos++; 6871if (_ps.chars[_ps.charPos] != '>') 6876else if (_ps.chars[_ps.charPos] == '>') 6884_ps.charPos++; 6889Debug.Assert(_ps.chars != null); 6891char quoteChar = _ps.chars[_ps.charPos]; 6897_ps.charPos++; 6908Debug.Assert(_ps.chars != null); 6909char[] chars = _ps.chars; 6910int pos = _ps.charPos; 6924_ps.charPos = pos + 1; 6929_ps.charPos = pos; 6942else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6968if (pos + 3 >= _ps.charsUsed && !_ps.isEof) 6983else if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 6993if (pos + 2 >= _ps.charsUsed && !_ps.isEof) 7011if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 7052if (pos == _ps.charsUsed) 7062if (pos + 1 == _ps.charsUsed) 7073ThrowInvalidChar(chars, _ps.charsUsed, pos); 7082if (_ps.charsUsed - _ps.charPos > 0) 7084if (_ps.chars[_ps.charPos] != (char)0xD) 7089Debug.Assert(_ps.isEof); 7096chars = _ps.chars; 7097pos = _ps.charPos; 7103int pos = _ps.charPos; 7105Debug.Assert(_ps.chars != null); 7106char[] chars = _ps.chars; 7121int tmp1 = pos - _ps.charPos; 7122if (sb != null && !_ps.eolNormalized) 7126sb.Append(chars, _ps.charPos, tmp1); 7129_ps.charPos = pos + 1; 7133else if (pos + 1 < _ps.charsUsed || _ps.isEof) 7135if (!_ps.eolNormalized) 7152if (pos == _ps.charsUsed) 7158int tmp2 = pos - _ps.charPos; 7161sb?.Append(_ps.chars, _ps.charPos, tmp2); 7162_ps.charPos = pos; 7171int tmp3 = pos - _ps.charPos; 7174sb?.Append(_ps.chars, _ps.charPos, tmp3); 7175_ps.charPos = pos; 7181if (_ps.charsUsed - _ps.charPos == 0) 7185if (_ps.chars[_ps.charPos] != (char)0xD) 7190Debug.Assert(_ps.isEof); 7192pos = _ps.charPos; 7193chars = _ps.chars; 7199Debug.Assert(_ps.chars != null); 7200Debug.Assert(_ps.chars[startPos] == '&'); 7201if (_ps.chars[startPos + 1] == '#') 7224switch (newPos = ParseNumericCharRefInline(_ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType)) 7233Debug.Assert(_ps.chars != null); 7234Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7239_ps.charPos = newPos - charCount; 7254Debug.Assert(_ps.chars != null); 7255Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#'); 7263chars = _ps.chars; 7285else if (pos < _ps.charsUsed) 7305_ps.charPos = pos; 7314if (pos == _ps.charsUsed) 7332Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(ch, '\0')); 7337internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7358Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(high, low)); 7365internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7385switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder)) 7396Debug.Assert(_ps.chars != null); 7397Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7402_ps.charPos = newPos - 1; 7417Debug.Assert(startPos < _ps.charsUsed); 7418Debug.Assert(_ps.chars != null); 7419Debug.Assert(_ps.chars[startPos] == '&'); 7420Debug.Assert(_ps.chars[startPos + 1] != '#'); 7423char[] chars = _ps.chars; 7434if (_ps.charsUsed - pos >= 3) 7451if (_ps.charsUsed - pos >= 4) 7466else if (pos < _ps.charsUsed) 7473if (_ps.charsUsed - pos >= 5) 7490if (_ps.charsUsed - pos >= 3) 7506if (_ps.charsUsed - pos >= 3) 7531internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos); 7532_ps.chars[pos - 1] = ch; 7550int pos = _ps.charPos + startOffset; 7553Debug.Assert(_ps.chars != null); 7554char[] chars = _ps.chars; 7563if (pos + 1 >= _ps.charsUsed) 7573Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 7600colonOffset = pos - _ps.charPos; 7606colonOffset = pos - _ps.charPos; 7612else if (pos == _ps.charsUsed) 7616Debug.Assert(_ps.chars != null); 7617chars = _ps.chars; 7624colonPos = (colonOffset == -1) ? -1 : _ps.charPos + colonOffset; 7630int offset = pos - _ps.charPos; 7632pos = _ps.charPos + offset; 7649Debug.Assert(_ps.chars != null); 7652if (_ps.chars[endPos] != ';') 7657string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 7658_ps.charPos = endPos + 1; 7702Debug.Assert(_ps.chars != null); 7707string localName = _nameTable.Add(_ps.chars, _ps.charPos, endNamePos - _ps.charPos); 7713int startPos = _ps.charPos; 7715if (prefixLen == _lastPrefix.Length && _ps.chars.AsSpan(_ps.charPos).StartsWith(_lastPrefix)) 7717return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7723string prefix = _nameTable.Add(_ps.chars, startPos, prefixLen); 7725return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7784_ps.lineNo++; 7785_ps.lineStartPos = pos - 1; 7790Debug.Assert(_ps.isEof); 7793_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8044Debug.Assert(_ps.appendMode); 8045int initialPos = _ps.charPos; 8053_ps.charPos = initialPos; 8060Encoding? enc = _ps.encoding; 8077Encoding? enc = _ps.encoding; 8085_ps.lineNo = entity.LineNumber; 8086_ps.lineStartPos = -entity.LinePosition - 1; 8088_ps.eolNormalized = true; 8095_ps.stream?.Dispose(); 8099_curNode.entityId = _ps.entityId; 8115_ps.entity = entity; 8116_ps.entityId = _nextEntityId++; 8130if (_ps.entity != null) 8132_currentEntities!.Remove(_ps.entity); 8150_parsingStatesStack[_parsingStatesStackTop] = _ps; 8152_ps.Clear(); 8159_ps.Close(true); 8171_incReadLeftStartPos = _ps.charPos; 8172_incReadLeftEndPos = _ps.charPos; 8173_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8216Debug.Assert(_ps.chars != null); 8226count = _incReadDecoder.Decode(_ps.chars, _incReadLeftStartPos, charsLeft); 8265Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 2).StartsWith("?>")); 8266_ps.charPos -= 2; 8273Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("-->")); 8274_ps.charPos -= 3; 8281Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("]]>")); 8282_ps.charPos -= 3; 8310char[] chars = _ps.chars; 8311startPos = _ps.charPos; 8316_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8357else if (pos + 1 < _ps.charsUsed) 8374if (_ps.charsUsed - pos < 2) 8387if (_ps.charsUsed - pos < 4) 8397if (_ps.charsUsed - pos < 9) 8415Debug.Assert(_ps.charPos - pos == 0); 8416Debug.Assert(_ps.charPos - startPos == 0); 8421if ((endPos - _ps.charPos - 2) == checkName.Length && chars.AsSpan(_ps.charPos + 2).StartsWith(checkName) && 8422(_ps.chars[endPos] == '>' || XmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8430_ps.charPos = endPos; 8431if (XmlCharType.IsWhiteSpace(_ps.chars[endPos])) 8435if (_ps.chars[_ps.charPos] != '>') 8439_ps.charPos++; 8447startPos = _ps.charPos; 8448chars = _ps.chars; 8455Debug.Assert(_ps.charPos - pos == 0); 8456Debug.Assert(_ps.charPos - startPos == 0); 8460if (endPos - _ps.charPos - 1 == _curNode.localName.Length && _ps.chars.AsSpan(_ps.charPos + 1).StartsWith(_curNode.localName) && 8461(_ps.chars[endPos] == '>' || _ps.chars[endPos] == '/' || XmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8469startPos = _ps.charPos; 8470chars = _ps.chars; 8479if (_ps.charsUsed - pos < 2) 8518if (pos == _ps.charsUsed) 8535_ps.charPos = pos; 8545count = _incReadDecoder.Decode(_ps.chars, startPos, charsParsed); 8583ParseAttributeValueSlow(_ps.charPos, ' ', _curNode); // The quote char is intentionally empty (space) because we need to parse ' and " into the attribute value 8606Debug.Assert(_ps.chars != null); 8608char[] chars = _ps.chars; 8609int pos = _ps.charPos; 8612_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8632Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!"); 8655if (pos - _ps.charPos > 0) 8657_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8660_ps.charPos = pos; 8668chars = _ps.chars; 8669if (_normalize && XmlCharType.IsWhiteSpace(chars[_ps.charPos]) && pos - _ps.charPos == 1) 8671chars[_ps.charPos] = (char)0x20; // CDATA normalization of character references in entities 8678_ps.charPos++; 8690chars = _ps.chars; 8694if (pos == _ps.charsUsed) 8704if (pos + 1 == _ps.charsUsed) 8717ThrowInvalidChar(chars, _ps.charsUsed, pos); 8723if (pos - _ps.charPos > 0) 8725_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8726_ps.charPos = pos; 8750pos = _ps.charPos; 8751chars = _ps.chars; 8755if (pos - _ps.charPos > 0) 8757_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8758_ps.charPos = pos; 8790_ps.charPos = pos; 8814_ps.charPos = pos; 8820if (_ps.charPos == _ps.charsUsed) 8825Debug.Assert(_ps.chars != null); 8827if (XmlCharType.IsNCNameSingleChar(_ps.chars[_ps.charPos])) 8829int pos = _ps.charPos + 1; 8830while (XmlCharType.IsNCNameSingleChar(_ps.chars[pos])) 8834return new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 8838Debug.Assert(_ps.charPos < _ps.charsUsed); 8839return new string(_ps.chars, _ps.charPos, 1); 8903Debug.Assert(_ps.chars != null); 8905if (_v1Compat && pos == _ps.charsUsed - 1 && _ps.chars[pos] == (char)0 && ReadData() == 0 && _ps.isStreamEof) 8907_ps.charsUsed--; 9413_curNode.AdjustLineInfo(_readValueOffset, _ps.eolNormalized, ref _incReadLineInfo); 9427Debug.Assert(_ps.chars != null); 9438_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 9443charsRead = _incReadDecoder.Decode(_ps.chars, startPos, endPos - startPos); 9458_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 9460AdjustLineInfo(_ps.chars, startPos - charsRead, startPos, _ps.eolNormalized, ref _incReadLineInfo);
System\Xml\Core\XmlTextReaderImplAsync.cs (652)
97_reportedEncoding = _ps.encoding; 128_reportedEncoding = _ps.encoding; 143_reportedEncoding = _ps.encoding; 178Debug.Assert(!_ps.appendMode); 219_reportedEncoding = _ps.encoding; 220_reportedBaseUri = _ps.baseUriStr; 226_curNode.SetLineInfo(_ps.lineNo, _ps.LinePos); 227_reportedEncoding = _ps.encoding; 228_reportedBaseUri = _ps.baseUriStr; 295_reportedEncoding = _ps.encoding; 300_reportedEncoding = _ps.encoding; 695BlockCopyChars(_ps.chars, startPos, buffer, (index + readCount), copyCount); 718_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 786if (e.ResString == SR.Xml_UnexpectedEOF && _ps.entity != null) 788SendValidationEvent(XmlSeverityType.Error, SR.Sch_ParEntityRefNesting, null, _ps.LineNo, _ps.LinePos); 818entityId = _ps.entityId; 837if (_ps.baseUri == null && !string.IsNullOrEmpty(_ps.baseUriStr)) 839_ps.baseUri = _xmlResolver!.ResolveUri(null, _ps.baseUriStr); 841await PushExternalEntityOrSubsetAsync(publicId, systemId, _ps.baseUri, null).ConfigureAwait(false); 843_ps.entity = null; 844_ps.entityId = 0; 846Debug.Assert(_ps.appendMode); 847int initialPos = _ps.charPos; 854_ps.charPos = initialPos; 868Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 872_ps.stream = stream; 873_ps.baseUri = baseUri; 874_ps.baseUriStr = baseUriStr; 880_ps.bytes = bytes; 881_ps.bytesUsed = byteCount; 882bufferSize = _ps.bytes.Length; 897if (_ps.bytes == null || _ps.bytes.Length < bufferSize) 899_ps.bytes = new byte[bufferSize]; 904if (_ps.chars == null || _ps.chars.Length < bufferSize + 1) 906_ps.chars = new char[bufferSize + 1]; 910_ps.bytePos = 0; 911if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0) 913int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed); 914int read = await stream.ReadAtLeastAsync(_ps.bytes.AsMemory(_ps.bytesUsed), bytesToRead, throwOnEndOfStream: false).ConfigureAwait(false); 917_ps.isStreamEof = true; 919_ps.bytesUsed += read; 929_documentStartBytePos = _ps.bytePos; 931_ps.eolNormalized = !_normalize; 934_ps.appendMode = true; 944Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 947_ps.textReader = input; 948_ps.baseUriStr = baseUriStr; 949_ps.baseUri = baseUri; 951if (_ps.chars == null) 964_ps.chars = new char[bufferSize + 1]; 967_ps.encoding = Encoding.Unicode; 968_ps.eolNormalized = !_normalize; 971_ps.appendMode = true; 1001if ((newEncoding.WebName != _ps.encoding!.WebName || _ps.decoder is SafeAsciiDecoder) && !_afterResetState) 1003Debug.Assert(_ps.stream != null); 1005_ps.appendMode = false; 1026if (_ps.isEof) 1032if (_ps.appendMode) 1035if (_ps.charsUsed == _ps.chars.Length - 1) 1058char[] newChars = new char[_ps.chars.Length * 2]; 1059BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 1060_ps.chars = newChars; 1063if (_ps.stream != null) 1066if (_ps.bytesUsed - _ps.bytePos < MaxByteSequenceLen) 1068if (_ps.bytes!.Length - _ps.bytesUsed < MaxByteSequenceLen) 1070byte[] newBytes = new byte[_ps.bytes.Length * 2]; 1071BlockCopy(_ps.bytes, 0, newBytes, 0, _ps.bytesUsed); 1072_ps.bytes = newBytes; 1077charsRead = _ps.chars.Length - _ps.charsUsed - 1; 1085int charsLen = _ps.chars.Length; 1086if (charsLen - _ps.charsUsed <= charsLen / 2) 1110int copyCharsCount = _ps.charsUsed - _ps.charPos; 1113_ps.lineStartPos -= _ps.charPos; 1116BlockCopyChars(_ps.chars, _ps.charPos, _ps.chars, 0, copyCharsCount); 1118_ps.charPos = 0; 1119_ps.charsUsed = copyCharsCount; 1123char[] newChars = new char[_ps.chars.Length * 2]; 1124BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 1125_ps.chars = newChars; 1129if (_ps.stream != null) 1132int bytesLeft = _ps.bytesUsed - _ps.bytePos; 1137_ps.bytesUsed = 0; 1141BlockCopy(_ps.bytes!, _ps.bytePos, _ps.bytes!, 0, bytesLeft); 1142_ps.bytesUsed = bytesLeft; 1144_ps.bytePos = 0; 1147charsRead = _ps.chars.Length - _ps.charsUsed - 1; 1150if (_ps.stream != null) 1152if (!_ps.isStreamEof) 1155if (_ps.bytePos == _ps.bytesUsed && _ps.bytes!.Length - _ps.bytesUsed > 0) 1157int read = await _ps.stream.ReadAsync(_ps.bytes.AsMemory(_ps.bytesUsed)).ConfigureAwait(false); 1160_ps.isStreamEof = true; 1162_ps.bytesUsed += read; 1166int originalBytePos = _ps.bytePos; 1170if (charsRead == 0 && _ps.bytePos != originalBytePos) 1176else if (_ps.textReader != null) 1179charsRead = await _ps.textReader.ReadAsync(_ps.chars.AsMemory(_ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1)).ConfigureAwait(false); 1180_ps.charsUsed += charsRead; 1191Debug.Assert(_ps.charsUsed < _ps.chars.Length); 1192_ps.isEof = true; 1194_ps.chars[_ps.charsUsed] = (char)0; 1201while (_ps.charsUsed - _ps.charPos < 6) 1209if (!_ps.chars.AsSpan(_ps.charPos).StartsWith(XmlDeclarationBeginning) || 1210XmlCharType.IsNameSingleChar(_ps.chars[_ps.charPos + 5])) 1217_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos + 2); 1220_ps.charPos += 5; 1236if (_ps.chars[_ps.charPos] == '?') 1240if (_ps.chars[_ps.charPos + 1] == '>') 1247_ps.charPos += 2; 1268string encodingName = _ps.encoding!.WebName; 1270encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 1272Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 1275if (_ps.decoder is SafeAsciiDecoder) 1284_ps.appendMode = false; 1287else if (_ps.charPos + 1 == _ps.charsUsed) 1306switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 1343attr!.SetLineInfo(_ps.LineNo, _ps.LinePos); 1345sb.Append(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 1346_ps.charPos = nameEndPos; 1349if (_ps.chars[_ps.charPos] != '=') 1352if (_ps.chars[_ps.charPos] != '=') 1358_ps.charPos++; 1360char quoteChar = _ps.chars[_ps.charPos]; 1364quoteChar = _ps.chars[_ps.charPos]; 1371_ps.charPos++; 1375attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 1379int pos = _ps.charPos; 1382chars = _ps.chars; 1389if (_ps.chars[pos] == quoteChar) 1396if (_ps.chars.AsSpan(_ps.charPos).StartsWith("1.0")) 1400attr!.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 1406string badVersion = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 1411string encName = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 1420switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 1430Throw(SR.Xml_InvalidXmlDecl, _ps.LineNo, _ps.LinePos - 1); 1435attr!.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 1443sb.Append(chars, _ps.charPos, pos - _ps.charPos); 1445_ps.charPos = pos + 1; 1448else if (pos == _ps.charsUsed) 1465if (_ps.isEof || await ReadDataAsync().ConfigureAwait(false) == 0) 1481string encodingName = _ps.encoding!.WebName; 1483encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 1485Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 1488if (_ps.decoder is SafeAsciiDecoder) 1492_ps.appendMode = false; 1504int pos = _ps.charPos; 1505char[] chars = _ps.chars; 1511if (_ps.charsUsed - pos < 4) // minimum "<a/>" 1518_ps.charPos = pos + 1; 1522if (_ps.charsUsed - pos < 2) // minimum characters expected "--" 1529_ps.charPos = pos + 2; 1543if (_ps.charsUsed - pos < 6) 1549_ps.charPos = pos + 6; 1559Throw(_ps.charPos, SR.Xml_InvalidRootData); 1568_ps.charPos = pos; 1600_ps.charPos = pos; 1610else if (pos == _ps.charsUsed || (_v1Compat && chars[pos] == 0x0)) 1627Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 1642int pos = _ps.charPos; 1763int pos = _ps.charPos; 1764char[] chars = _ps.chars; 1774_ps.charPos = pos + 2; 1778if (_ps.charsUsed - pos < 2) 1785_ps.charPos = pos + 2; 1797if (_ps.charsUsed - pos < 6) 1803_ps.charPos = pos + 6; 1825_ps.charPos = pos + 2; 1829if (pos + 1 == _ps.charsUsed) 1836_ps.charPos = pos + 1; 1845if (pos == _ps.charsUsed) 1863if (_ps.charsUsed - _ps.charPos != 0) 1888int pos = _ps.charPos; 1889char[] chars = _ps.chars; 1892_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 1943else if (pos + 1 < _ps.charsUsed) 1981char[] chars = _ps.chars; 1990_nameTable.Add(chars, _ps.charPos, pos - _ps.charPos)); 1994int startPos = _ps.charPos; 2007_nameTable.Add(chars, _ps.charPos, prefixLen), 2019_ps.charPos = pos; 2033int pos = _ps.charPos; 2034char[] chars = _ps.chars; 2039_ps.charPos = pos + 1; 2045if (pos + 1 == _ps.charsUsed) 2047_ps.charPos = pos; 2055_ps.charPos = pos + 2; 2065Throw(pos, SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 2097if (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 2119while (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 2135char[] chars = _ps.chars; 2138if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.localName)) 2146int colonPos = _ps.charPos + prefLen; 2147if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.prefix) || 2155LineInfo endTagLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 2217pos = _ps.charPos + nameLen; 2218chars = _ps.chars; 2220if (pos == _ps.charsUsed) 2255else if (pos == _ps.charsUsed && !_ps.isEof) 2269else if (pos == _ps.charsUsed) 2290_ps.charPos = pos + 1; 2324args[3] = new string(_ps.chars, _ps.charPos, endPos - _ps.charPos); 2337int pos = _ps.charPos; 2338char[] chars = _ps.chars; 2364else if (pos + 1 != _ps.charsUsed) 2371_ps.charPos = pos; 2392_ps.charPos = pos + 1; 2400if (pos + 1 == _ps.charsUsed) 2406_ps.charPos = pos + 2; 2417else if (pos == _ps.charsUsed) 2423Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 2427if (pos == _ps.charPos) 2431_ps.charPos = pos; 2434int attrNameLinePos = _ps.LinePos; 2496chars = _ps.chars; 2499else if (pos + 1 >= _ps.charsUsed) 2506chars = _ps.chars; 2510attr.SetLineInfo(_ps.LineNo, attrNameLinePos); 2519_ps.charPos = pos; 2521pos = _ps.charPos; 2532_ps.charPos = pos; 2534pos = _ps.charPos; 2542_ps.charPos = pos; 2545attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 2563attr.SetValue(chars, _ps.charPos, pos - _ps.charPos); 2565_ps.charPos = pos; 2570pos = _ps.charPos; 2571chars = _ps.chars; 2599_ps.lineNo -= lineNoDelta; 2602pos = _ps.charPos; 2603chars = _ps.chars; 2636char[] chars = _ps.chars; 2637int attributeBaseEntityId = _ps.entityId; 2640LineInfo valueChunkLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 2653if (pos - _ps.charPos > 0) 2655_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 2656_ps.charPos = pos; 2659if (chars[pos] == quoteChar && attributeBaseEntityId == _ps.entityId) 2674_ps.charPos++; 2683_stringBuilder.Append(_ps.eolNormalized ? "\u0020\u0020" : "\u0020"); // CDATA normalization of 0xD 0xA 2684_ps.charPos = pos; 2687else if (pos + 1 < _ps.charsUsed || _ps.isEof) 2693_ps.charPos = pos; 2708_ps.charPos++; 2722if (pos - _ps.charPos > 0) 2724_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 2726_ps.charPos = pos; 2729int enclosingEntityId = _ps.entityId; 2730LineInfo entityLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos + 1); 2743if (_parsingMode == ParsingMode.Full && _ps.entityId == attributeBaseEntityId) 2757_ps.charPos++; 2774valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 2780_ps.charPos++; 2783pos = _ps.charPos; 2804entityChunk.SetNamedNode(XmlNodeType.EntityReference, _ps.entity!.Name); 2812pos = _ps.charPos; 2815pos = _ps.charPos; 2818chars = _ps.chars; 2822if (pos == _ps.charsUsed) 2832if (pos + 1 == _ps.charsUsed) 2843ThrowInvalidChar(chars, _ps.charsUsed, pos); 2853if (_ps.charsUsed - _ps.charPos > 0) 2855if (_ps.chars[_ps.charPos] != (char)0xD) 2860Debug.Assert(_ps.isEof); 2868if (attributeBaseEntityId != _ps.entityId) 2883if (attributeBaseEntityId == _ps.entityId) 2886valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 2891pos = _ps.charPos; 2892chars = _ps.chars; 2910_ps.charPos = pos + 1; 2928_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 2960_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 2996_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3019_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 3034_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3045_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3070_curNode.SetValueNode(XmlNodeType.Text, _ps.chars, startPos, endPos - startPos); 3079_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3092_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3199Task<(int, int, int, bool)> task = ParseTextAsync(outOrChars, _ps.chars, _ps.charPos, 0, -1, outOrChars); 3298if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 3300if (pos - _ps.charPos > 0) 3316_ps.charPos++; 3321else if (pos + 1 < _ps.charsUsed || _ps.isEof) 3323if (!_ps.eolNormalized) 3348if (_ps.charsUsed - pos < 3 && !_ps.isEof) 3363if (pos == _ps.charsUsed) 3403if (pos > _ps.charPos) 3433if (!XmlCharType.IsWhiteSpace(_ps.chars[pos - 1])) 3439pos = _ps.charPos; 3442chars = _ps.chars; 3455if (pos + 1 == _ps.charsUsed) 3471int offset = pos - _ps.charPos; 3474chars = _ps.chars; 3475pos = _ps.charPos + offset; 3482ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos + offset); 3490if (pos > _ps.charPos) 3499if (_ps.charsUsed - _ps.charPos > 0) 3501if (_ps.chars[_ps.charPos] != (char)0xD && _ps.chars[_ps.charPos] != ']') 3505Debug.Assert(_ps.isEof); 3529pos = _ps.charPos; 3530chars = _ps.chars; 3547int startPos = _ps.charPos; 3549_ps.charPos = pos; 3576_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3583_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3714if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || await ZeroEndingStreamAsync(_ps.charPos).ConfigureAwait(false)) 3721_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3723if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || await ZeroEndingStreamAsync(_ps.charPos).ConfigureAwait(false)) 3735if (XmlCharType.IsCharData(_ps.chars[_ps.charPos])) 3741ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos); 3748Debug.Assert(_ps.chars[_ps.charPos] == '&'); 3749_ps.charPos++; 3751_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3759Debug.Assert(_ps.chars[_ps.charPos] == '&'); 3761if (_ps.charPos + 1 == _ps.charsUsed) 3770if (_ps.chars[_ps.charPos + 1] == '#') 3805_ps.charPos++; 3806int savedLinePos = _ps.LinePos; 3813Throw(SR.Xml_ErrorParsingEntityName, _ps.LineNo, savedLinePos); 3819if (_ps.chars[endPos] != ';') 3824int entityLinePos = _ps.LinePos; 3825string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 3826_ps.charPos = endPos + 1; 3830_reportedBaseUri = _ps.baseUriStr; 3831_reportedEncoding = _ps.encoding; 3859Throw(SR.Xml_UndeclaredEntity, name, _ps.LineNo, entityStartLinePos); 3872Throw(SR.Xml_UnparsedEntityRef, name, _ps.LineNo, entityStartLinePos); 3877Throw(SR.Xml_ExternalEntityInStandAloneDocument, entity.Name, _ps.LineNo, entityStartLinePos); 3884Throw(SR.Xml_ExternalEntityInAttValue, name, _ps.LineNo, entityStartLinePos); 3898_curNode.entityId = _ps.entityId; 3906_curNode.entityId = _ps.entityId; 3919_curNode.entityId = _ps.entityId; 3935_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3942string target = _nameTable.Add(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 3948_ps.charPos = nameEndPos; 3963char ch = _ps.chars[_ps.charPos]; 3964Debug.Assert(_ps.charPos < _ps.charsUsed); 3967if (_ps.charsUsed - _ps.charPos < 2) 3971if (ch != '?' || _ps.chars[_ps.charPos + 1] != '>') 3973Throw(SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(_ps.chars, _ps.charsUsed, _ps.charPos)); 3994_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 3999piInDtdStringBuilder.Append(_ps.chars, startPos, endPos - startPos); 4029sb.Append(_ps.chars, startPos, endPos - startPos); 4036sb.Append(_ps.chars, startPos, endPos - startPos); 4053if (_ps.charsUsed - _ps.charPos < 2) 4057Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF, "PI"); 4061int pos = _ps.charPos; 4062char[] chars = _ps.chars; 4083Debug.Assert(!_ps.eolNormalized); 4091outStartPos = _ps.charPos; 4092_ps.charPos = pos + 2; 4096else if (pos + 1 == _ps.charsUsed) 4113if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 4116if (pos - _ps.charPos > 0) 4132_ps.charPos++; 4137else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4139if (!_ps.eolNormalized) 4159if (pos == _ps.charsUsed) 4169if (pos + 1 == _ps.charsUsed) 4180ThrowInvalidChar(chars, _ps.charsUsed, pos); 4196outStartPos = _ps.charPos; 4197_ps.charPos = pos; 4231_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4240_curNode.SetValueNode(type, _ps.chars, startPos, endPos - startPos); 4248_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 4255_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 4277if (_ps.charsUsed - _ps.charPos < 3) 4286int pos = _ps.charPos; 4287char[] chars = _ps.chars; 4309Debug.Assert(!_ps.eolNormalized); 4317outStartPos = _ps.charPos; 4318_ps.charPos = pos + 3; 4322else if (pos + 2 == _ps.charsUsed) 4331else if (pos + 1 == _ps.charsUsed) 4351if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 4353if (pos - _ps.charPos > 0) 4369_ps.charPos++; 4374else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4376if (!_ps.eolNormalized) 4396if (pos == _ps.charsUsed) 4404if (pos + 1 == _ps.charsUsed) 4415ThrowInvalidChar(chars, _ps.charsUsed, pos); 4430outStartPos = _ps.charPos; 4432_ps.charPos = pos; 4447while (_ps.charsUsed - _ps.charPos < 8) 4454if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("DOCTYPE")) 4458if (!XmlCharType.IsWhiteSpace(_ps.chars[_ps.charPos + 7])) 4460ThrowExpectingWhitespace(_ps.charPos + 7); 4465Throw(_ps.charPos - 2, SR.Xml_MultipleDTDsProvided); // position just before <!DOCTYPE 4469Throw(_ps.charPos - 2, SR.Xml_DtdAfterRootElement); 4472_ps.charPos += 8; 4479_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4521_ps.charPos = pos; 4527if (_ps.chars[_ps.charPos] == 'P') 4530while (_ps.charsUsed - _ps.charPos < 6) 4538if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("PUBLIC")) 4542_ps.charPos += 6; 4547ThrowExpectingWhitespace(_ps.charPos); 4556ThrowExpectingWhitespace(_ps.charPos); 4564else if (_ps.chars[_ps.charPos] == 'S') 4567while (_ps.charsUsed - _ps.charPos < 6) 4575if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("SYSTEM")) 4579_ps.charPos += 6; 4584ThrowExpectingWhitespace(_ps.charPos); 4592else if (_ps.chars[_ps.charPos] != '[' && _ps.chars[_ps.charPos] != '>') 4598if (_ps.chars[_ps.charPos] == '[') 4600_ps.charPos++; 4605if (_ps.chars[_ps.charPos] != '>') 4610else if (_ps.chars[_ps.charPos] == '>') 4618_ps.charPos++; 4624char quoteChar = _ps.chars[_ps.charPos]; 4630_ps.charPos++; 4641char[] chars = _ps.chars; 4642int pos = _ps.charPos; 4656_ps.charPos = pos + 1; 4661_ps.charPos = pos; 4674else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4700if (pos + 3 >= _ps.charsUsed && !_ps.isEof) 4715else if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 4725if (pos + 2 >= _ps.charsUsed && !_ps.isEof) 4743if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 4784if (pos == _ps.charsUsed) 4794if (pos + 1 == _ps.charsUsed) 4805ThrowInvalidChar(chars, _ps.charsUsed, pos); 4814if (_ps.charsUsed - _ps.charPos > 0) 4816if (_ps.chars[_ps.charPos] != (char)0xD) 4821Debug.Assert(_ps.isEof); 4828chars = _ps.chars; 4829pos = _ps.charPos; 4835int pos = _ps.charPos; 4837char[] chars = _ps.chars; 4852int tmp1 = pos - _ps.charPos; 4853if (sb != null && !_ps.eolNormalized) 4857sb.Append(chars, _ps.charPos, tmp1); 4860_ps.charPos = pos + 1; 4864else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4866if (!_ps.eolNormalized) 4883if (pos == _ps.charsUsed) 4889int tmp2 = pos - _ps.charPos; 4892sb?.Append(_ps.chars, _ps.charPos, tmp2); 4893_ps.charPos = pos; 4902int tmp3 = pos - _ps.charPos; 4905sb?.Append(_ps.chars, _ps.charPos, tmp3); 4906_ps.charPos = pos; 4912if (_ps.charsUsed - _ps.charPos == 0) 4916if (_ps.chars[_ps.charPos] != (char)0xD) 4921Debug.Assert(_ps.isEof); 4923pos = _ps.charPos; 4924chars = _ps.chars; 4942switch (newPos = ParseNumericCharRefInline(_ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType)) 4950Debug.Assert(_ps.chars[_ps.charPos] == '&'); 4955_ps.charPos = newPos - charCount; 4974switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder)) 4984Debug.Assert(_ps.chars[_ps.charPos] == '&'); 4989_ps.charPos = newPos - 1; 5012int pos = _ps.charPos + startOffset; 5015char[] chars = _ps.chars; 5024if (pos + 1 >= _ps.charsUsed) 5037Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 5064colonOffset = pos - _ps.charPos; 5070colonOffset = pos - _ps.charPos; 5076else if (pos == _ps.charsUsed) 5083chars = _ps.chars; 5090colonPos = (colonOffset == -1) ? -1 : _ps.charPos + colonOffset; 5097int offset = pos - _ps.charPos; 5099pos = _ps.charPos + offset; 5118if (_ps.chars[endPos] != ';') 5123string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 5124_ps.charPos = endPos + 1; 5241Debug.Assert(_ps.appendMode); 5242int initialPos = _ps.charPos; 5249_ps.charPos = initialPos; 5255Encoding? enc = _ps.encoding; 5275if (_v1Compat && pos == _ps.charsUsed - 1 && _ps.chars[pos] == (char)0 && await ReadDataAsync().ConfigureAwait(false) == 0 && _ps.isStreamEof) 5277_ps.charsUsed--; 5409_curNode.AdjustLineInfo(_readValueOffset, _ps.eolNormalized, ref _incReadLineInfo); 5433_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 5443charsRead = _incReadDecoder.Decode(_ps.chars, startPos, endPos - startPos); 5457_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 5459AdjustLineInfo(_ps.chars, startPos - charsRead, startPos, _ps.eolNormalized, ref _incReadLineInfo);