1 write to _ps
System.Private.Xml (1)
System\Xml\Core\XmlTextReaderImpl.cs (1)
8118_ps = _parsingStatesStack[_parsingStatesStackTop--];
1706 references to _ps
System.Private.Xml (1706)
System\Xml\Core\XmlTextReaderImpl.cs (1050)
351_ps.lineNo = 1; 352_ps.lineStartPos = -1; 413_ps.lineNo = _lineNumberOffset + 1; 414_ps.lineStartPos = -_linePositionOffset - 1; 415_curNode.SetLineInfo(_ps.LineNo - 1, _ps.LinePos - 1); 475_reportedBaseUri = _ps.baseUriStr; 476_reportedEncoding = _ps.encoding; 499_reportedEncoding = _ps.encoding; 522_reportedBaseUri = _ps.baseUriStr; 523_reportedEncoding = _ps.encoding; 544_reportedEncoding = _ps.encoding; 575_ps.baseUri = GetTempResolver().ResolveUri(null, url); 576_ps.baseUriStr = _ps.baseUri.ToString(); 577_reportedBaseUri = _ps.baseUriStr; 663_reportedEncoding = _ps.encoding; 743_reportedEncoding = _ps.encoding; 796_reportedEncoding = _ps.encoding; 814_reportedBaseUri = _ps.baseUriStr; 815_reportedEncoding = _ps.encoding; 1237Debug.Assert(!_ps.appendMode); 1246_reportedEncoding = _ps.encoding; 1249_reportedEncoding = _ps.encoding; 1286_reportedEncoding = _ps.encoding; 1287_reportedBaseUri = _ps.baseUriStr; 1293_curNode.SetLineInfo(_ps.lineNo, _ps.LinePos); 1294_reportedEncoding = _ps.encoding; 1295_reportedBaseUri = _ps.baseUriStr; 1467_attributeValueBaseEntityId = _ps.entityId; 1472if (_ps.entityId == _attributeValueBaseEntityId) 1508if (_ps.charsUsed - _ps.charPos == 0) 1529if (_ps.charsUsed - _ps.charPos == 0 && !_ps.entity!.IsExternal) 1547_ps.entityResolvedManually = true; 1867Debug.Assert(_ps.chars != null); 1868BlockCopyChars(_ps.chars, startPos, buffer, (index + readCount), copyCount); 1891Debug.Assert(_ps.chars != null); 1892_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 2020if (_ps.entity == null || _ps.entity.IsExternal) 2022_ps.eolNormalized = !value; 2111_ps.baseUri = null; 2178_stringBuilder.Append(_ps.chars, _incReadLeftStartPos, _incReadLeftEndPos - _incReadLeftStartPos); 2188_ps.appendMode = false; 2191_stringBuilder.Append(_ps.chars, _ps.charPos, _ps.charsUsed - _ps.charPos); 2192_ps.charPos = _ps.charsUsed; 2363if (_ps.baseUriStr.Length > 0 && _ps.baseUri == null && _xmlResolver != null) 2365_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2368return _ps.baseUri; 2376return _ps.isEof; 2384return _ps.chars; 2392return _ps.charsUsed; 2400return _ps.charPos; 2404Debug.Assert(value >= 0 && value <= _ps.charsUsed); 2405_ps.charPos = value; 2421return _ps.eolNormalized; 2446return _ps.LineNo; 2454return _ps.lineStartPos; 2514if (e.ResString == SR.Xml_UnexpectedEOF && _ps.entity != null) 2516SendValidationEvent(XmlSeverityType.Error, SR.Sch_ParEntityRefNesting, null, _ps.LineNo, _ps.LinePos); 2555entityId = _ps.entityId; 2568oldEntity = _ps.entity; 2570newEntityId = _ps.entityId; 2588if (_ps.baseUri == null && !string.IsNullOrEmpty(_ps.baseUriStr)) 2590_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2593PushExternalEntityOrSubset(publicId, systemId, _ps.baseUri, null); 2595_ps.entity = null; 2596_ps.entityId = 0; 2598Debug.Assert(_ps.appendMode); 2599int initialPos = _ps.charPos; 2606_ps.charPos = initialPos; 2622_ps.entity = null; 2623_ps.entityId = 0; 2624_ps.eolNormalized = false; 2655_ps.charPos = pos; 2662_ps.charPos = pos; 2669_ps.charPos = pos; 2682Throw(new XmlException(res, string.Empty, lineNo, linePos, _ps.baseUriStr)); 2688Throw(new XmlException(res, arg, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2694Throw(new XmlException(res, arg, lineNo, linePos, _ps.baseUriStr)); 2700Throw(new XmlException(res, args, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2712Throw(new XmlException(res, args, innerException, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2732Throw(new XmlException(e.Message, (Exception?)null, lineNo, linePos, _ps.baseUriStr)); 2738Throw(new XmlException(res, string.Empty, _ps.baseUriStr)); 2744Throw(new XmlException(res, arg, _ps.baseUriStr)); 2750Throw(new XmlException(res, args, innerException, 0, 0, _ps.baseUriStr)); 2767SendValidationEvent(severity, new XmlSchemaException(code, arg, _ps.baseUriStr, lineNo, linePos)); 2800while (_ps.entityId != _attributeValueBaseEntityId) 2842Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 2846_ps.stream = stream; 2847_ps.baseUri = baseUri; 2848_ps.baseUriStr = baseUriStr; 2854_ps.bytes = bytes; 2855_ps.bytesUsed = byteCount; 2856bufferSize = _ps.bytes.Length; 2869if (_ps.bytes == null || _ps.bytes.Length < bufferSize) 2871_ps.bytes = new byte[bufferSize]; 2876if (_ps.chars == null || _ps.chars.Length < bufferSize + 1) 2878_ps.chars = new char[bufferSize + 1]; 2882_ps.bytePos = 0; 2883if (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0) 2885int bytesToRead = Math.Min(4, _ps.bytes.Length - _ps.bytesUsed); 2886int read = stream.ReadAtLeast(_ps.bytes.AsSpan(_ps.bytesUsed), bytesToRead, throwOnEndOfStream: false); 2889_ps.isStreamEof = true; 2891_ps.bytesUsed += read; 2901_documentStartBytePos = _ps.bytePos; 2903_ps.eolNormalized = !_normalize; 2906_ps.appendMode = true; 2917Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 2920_ps.textReader = input; 2921_ps.baseUriStr = baseUriStr; 2922_ps.baseUri = baseUri; 2924if (_ps.chars == null) 2928_ps.chars = new char[XmlReader.AsyncBufferSize + 1]; 2932_ps.chars = new char[XmlReader.DefaultBufferSize + 1]; 2936_ps.encoding = Encoding.Unicode; 2937_ps.eolNormalized = !_normalize; 2940_ps.appendMode = true; 2946Debug.Assert(_ps.stream == null && _ps.textReader == null); 2947Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0); 2951_ps.baseUriStr = baseUriStr; 2952_ps.baseUri = null; 2955_ps.chars = new char[len + 1]; 2956str.CopyTo(0, _ps.chars, 0, str.Length); 2957_ps.charsUsed = len; 2958_ps.chars[len] = (char)0; 2960_ps.encoding = originalEncoding; 2962_ps.eolNormalized = !_normalize; 2963_ps.isEof = true; 2982_ps.baseUriStr = parserContext.BaseURI; 2983_ps.baseUri = null; 2990_ps.baseUriStr = string.Empty; 2991_ps.baseUri = null; 2994_reportedBaseUri = _ps.baseUriStr; 2999_ps.appendMode = false; 3014_ps.appendMode = false; 3060if (_ps.baseUri == null) 3062_ps.baseUri = tmpResolver.ResolveUri(null, _url); 3063_ps.baseUriStr = _ps.baseUri.ToString(); 3068_ps.stream = (Stream?)tmpResolver.GetEntity(_ps.baseUri, null, typeof(Stream)); 3076if (_ps.stream == null) 3078ThrowWithoutLineInfo(SR.Xml_CannotResolveUrl, _ps.baseUriStr); 3081Debug.Assert(_ps.stream != null); 3082InitStreamInput(_ps.baseUri, _ps.baseUriStr, _ps.stream, null); 3083_reportedEncoding = _ps.encoding; 3089Debug.Assert(_ps.bytes != null); 3090Debug.Assert(_ps.bytePos == 0); 3092if (_ps.bytesUsed < 2) 3097int first2Bytes = _ps.bytes[0] << 8 | _ps.bytes[1]; 3098int next2Bytes = (_ps.bytesUsed >= 4) ? (_ps.bytes[2] << 8 | _ps.bytes[3]) : 0; 3176Debug.Assert(_ps.charPos == 0); 3177_ps.encoding = Encoding.UTF8; 3178_ps.decoder = new SafeAsciiDecoder(); 3182_ps.encoding = encoding; 3183_ps.decoder = _ps.encoding.WebName switch // Encoding.Codepage is not supported in Silverlight 3194Debug.Assert(_ps.encoding != null); 3195Debug.Assert(_ps.bytes != null); 3196ReadOnlySpan<byte> preamble = _ps.encoding.Preamble; 3197if (_ps.bytes.AsSpan(0, _ps.bytesUsed).StartsWith(preamble)) 3199_ps.bytePos = preamble.Length; 3206Debug.Assert(_ps.encoding != null); 3207if ((newEncoding.WebName != _ps.encoding.WebName || _ps.decoder is SafeAsciiDecoder) && !_afterResetState) 3209Debug.Assert(_ps.stream != null); 3211_ps.appendMode = false; 3221Debug.Assert(_ps.encoding != null); 3224if (_ps.stream == null) 3226return _ps.encoding; 3234if (_ps.encoding.WebName != "utf-16BE" && 3235_ps.encoding.WebName != "utf-16" && 3247return _ps.encoding; 3275if (_afterResetState && _ps.encoding.WebName != newEncoding.WebName) 3285Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3286Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false"); 3288Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range."); 3296Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos, 3298_charactersInDocument -= _ps.charsUsed - _ps.charPos; 3305Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos, 3307_charactersFromEntities -= _ps.charsUsed - _ps.charPos; 3311_ps.bytePos = _documentStartBytePos; // byte position after preamble 3312if (_ps.charPos > 0) 3314Debug.Assert(_ps.encoding != null); 3315Debug.Assert(_ps.chars != null); 3316_ps.bytePos += _ps.encoding.GetByteCount(_ps.chars, 0, _ps.charPos); 3319_ps.charsUsed = _ps.charPos; 3320_ps.isEof = false; 3336if (_ps.isEof) 3341Debug.Assert(_ps.chars != null); 3343if (_ps.appendMode) 3346if (_ps.charsUsed == _ps.chars.Length - 1) 3354char[] newChars = new char[_ps.chars.Length * 2]; 3355BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3356_ps.chars = newChars; 3359if (_ps.stream != null) 3362if (_ps.bytesUsed - _ps.bytePos < MaxByteSequenceLen) 3364Debug.Assert(_ps.bytes != null); 3365if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen) 3367byte[] newBytes = new byte[_ps.bytes.Length * 2]; 3368BlockCopy(_ps.bytes, 0, newBytes, 0, _ps.bytesUsed); 3369_ps.bytes = newBytes; 3374charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3382int charsLen = _ps.chars.Length; 3383if (charsLen - _ps.charsUsed <= charsLen / 2) 3392int copyCharsCount = _ps.charsUsed - _ps.charPos; 3395_ps.lineStartPos -= _ps.charPos; 3398BlockCopyChars(_ps.chars, _ps.charPos, _ps.chars, 0, copyCharsCount); 3400_ps.charPos = 0; 3401_ps.charsUsed = copyCharsCount; 3405char[] newChars = new char[_ps.chars.Length * 2]; 3406BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3407_ps.chars = newChars; 3411if (_ps.stream != null) 3414int bytesLeft = _ps.bytesUsed - _ps.bytePos; 3419_ps.bytesUsed = 0; 3423Debug.Assert(_ps.bytes != null); 3424BlockCopy(_ps.bytes, _ps.bytePos, _ps.bytes, 0, bytesLeft); 3425_ps.bytesUsed = bytesLeft; 3428_ps.bytePos = 0; 3431charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3434if (_ps.stream != null) 3436if (!_ps.isStreamEof) 3438Debug.Assert(_ps.bytes != null); 3441if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0) 3443int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed); 3446_ps.isStreamEof = true; 3448_ps.bytesUsed += read; 3452int originalBytePos = _ps.bytePos; 3456if (charsRead == 0 && _ps.bytePos != originalBytePos) 3462else if (_ps.textReader != null) 3465charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1); 3466_ps.charsUsed += charsRead; 3477Debug.Assert(_ps.charsUsed < _ps.chars.Length); 3478_ps.isEof = true; 3481_ps.chars[_ps.charsUsed] = (char)0; 3488Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3489Debug.Assert(_ps.chars != null); 3490Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1); 3493int bytesCount = _ps.bytesUsed - _ps.bytePos; 3504_ps.decoder.Convert(_ps.bytes, _ps.bytePos, bytesCount, _ps.chars, _ps.charsUsed, maxCharsCount, false, out bytesCount, out charsCount, out completed); 3512_ps.bytePos += bytesCount; 3513_ps.charsUsed += charsCount; 3529Debug.Assert(_ps.decoder != null); 3530Debug.Assert(_ps.bytes != null); 3531Debug.Assert(_ps.chars != null); 3532_ps.decoder.Convert(_ps.bytes, _ps.bytePos + bytesDecoded, 1, _ps.chars, _ps.charsUsed + charsDecoded, 2, false, out bDec, out chDec, out completed); 3545Throw(_ps.charsUsed, SR.Xml_InvalidCharInThisEncoding); 3564_ps.Close(closeInput); 3579Debug.Assert(_ps.chars != null); 3580BlockCopyChars(_ps.chars, sourcePos, _ps.chars, destPos, count); 3586while (_ps.charsUsed - _ps.charPos < 6) 3594if (!_ps.chars.AsSpan(_ps.charPos).StartsWith(XmlDeclarationBeginning) || 3595XmlCharType.IsNameSingleChar(_ps.chars![_ps.charPos + 5])) 3602_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos + 2); 3606_ps.charPos += 5; 3622if (_ps.chars[_ps.charPos] == '?') 3626if (_ps.chars[_ps.charPos + 1] == '>') 3633_ps.charPos += 2; 3653Debug.Assert(_ps.encoding != null); 3654string encodingName = _ps.encoding.WebName; 3656encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3658Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3661if (_ps.decoder is SafeAsciiDecoder) 3670_ps.appendMode = false; 3673else if (_ps.charPos + 1 == _ps.charsUsed) 3692switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 3731attr.SetLineInfo(_ps.LineNo, _ps.LinePos); 3733sb.Append(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 3734_ps.charPos = nameEndPos; 3737if (_ps.chars[_ps.charPos] != '=') 3740if (_ps.chars[_ps.charPos] != '=') 3746_ps.charPos++; 3748char quoteChar = _ps.chars[_ps.charPos]; 3752quoteChar = _ps.chars[_ps.charPos]; 3759_ps.charPos++; 3764attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 3768int pos = _ps.charPos; 3771chars = _ps.chars; 3777if (_ps.chars[pos] == quoteChar) 3784if (_ps.chars.AsSpan(_ps.charPos).StartsWith("1.0")) 3789attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3795string badVersion = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3800string encName = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3810switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 3820Throw(SR.Xml_InvalidXmlDecl, _ps.LineNo, _ps.LinePos - 1); 3826attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3834sb.Append(chars, _ps.charPos, pos - _ps.charPos); 3836_ps.charPos = pos + 1; 3839else if (pos == _ps.charsUsed) 3856if (_ps.isEof || ReadData() == 0) 3871Debug.Assert(_ps.encoding != null); 3872string encodingName = _ps.encoding.WebName; 3874encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3876Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3879if (_ps.decoder is SafeAsciiDecoder) 3883_ps.appendMode = false; 3894int pos = _ps.charPos; 3895Debug.Assert(_ps.chars != null); 3896char[] chars = _ps.chars; 3902if (_ps.charsUsed - pos < 4) // minimum "<a/>" 3909_ps.charPos = pos + 1; 3917if (_ps.charsUsed - pos < 2) // minimum characters expected "--" 3924_ps.charPos = pos + 2; 3942if (_ps.charsUsed - pos < 6) 3948_ps.charPos = pos + 6; 3963Throw(_ps.charPos, SR.Xml_InvalidRootData); 3972_ps.charPos = pos; 4008_ps.charPos = pos; 4049else if (pos == _ps.charsUsed || ((_v1Compat || mangoQuirks) && chars[pos] == 0x0)) 4077Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 4119int pos = _ps.charPos; 4120Debug.Assert(_ps.chars != null); 4121char[] chars = _ps.chars; 4131_ps.charPos = pos + 2; 4139if (_ps.charsUsed - pos < 2) 4146_ps.charPos = pos + 2; 4162if (_ps.charsUsed - pos < 6) 4168_ps.charPos = pos + 6; 4191_ps.charPos = pos + 2; 4196if (pos + 1 == _ps.charsUsed) 4203_ps.charPos = pos + 1; 4217if (pos == _ps.charsUsed) 4236if (_ps.charsUsed - _ps.charPos != 0) 4262Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF1); 4286Throw(_ps.charsUsed, SR.Xml_UnexpectedEOFInElementContent, _stringBuilder.ToString()); 4293int pos = _ps.charPos; 4294Debug.Assert(_ps.chars != null); 4295char[] chars = _ps.chars; 4298_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4349else if (pos + 1 < _ps.charsUsed) 4356chars = _ps.chars; 4367_nameTable.Add(chars, _ps.charPos, pos - _ps.charPos)); 4371int startPos = _ps.charPos; 4384_nameTable.Add(chars, _ps.charPos, prefixLen), 4395_ps.charPos = pos; 4405_ps.charPos = pos + 1; 4411if (pos + 1 == _ps.charsUsed) 4413_ps.charPos = pos; 4418pos = _ps.charPos; 4419chars = _ps.chars; 4426_ps.charPos = pos + 2; 4436Throw(pos, SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4536while (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 4545Debug.Assert(_ps.chars != null); 4546char[] chars = _ps.chars; 4549if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.localName)) 4557int colonPos = _ps.charPos + prefLen; 4558if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.prefix) || 4567LineInfo endTagLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 4572pos = _ps.charPos + nameLen; 4573chars = _ps.chars; 4575if (pos == _ps.charsUsed) 4602else if (pos == _ps.charsUsed && !_ps.isEof) 4616else if (pos == _ps.charsUsed) 4642_ps.charPos = pos + 1; 4656Debug.Assert(_ps.chars != null); 4661args[3] = new string(_ps.chars, _ps.charPos, endPos - _ps.charPos); 4674int pos = _ps.charPos; 4675Debug.Assert(_ps.chars != null); 4676char[] chars = _ps.chars; 4701else if (pos + 1 != _ps.charsUsed) 4708_ps.charPos = pos; 4729_ps.charPos = pos + 1; 4737if (pos + 1 == _ps.charsUsed) 4743_ps.charPos = pos + 2; 4754else if (pos == _ps.charsUsed) 4760Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4764if (pos == _ps.charPos) 4768_ps.charPos = pos; 4771int attrNameLinePos = _ps.LinePos; 4774int attrNameLineNo = _ps.LineNo; 4827chars = _ps.chars; 4830else if (pos + 1 >= _ps.charsUsed) 4833chars = _ps.chars; 4837attr.SetLineInfo(_ps.LineNo, attrNameLinePos); 4840Debug.Assert(attrNameLineNo == _ps.LineNo); 4846_ps.charPos = pos; 4848pos = _ps.charPos; 4859_ps.charPos = pos; 4861pos = _ps.charPos; 4869_ps.charPos = pos; 4872attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 4886string val = new string(chars, _ps.charPos, pos - _ps.charPos); 4890attr.SetValue(chars, _ps.charPos, pos - _ps.charPos); 4892_ps.charPos = pos; 4897pos = _ps.charPos; 4898chars = _ps.chars; 4926_ps.lineNo -= lineNoDelta; 4929pos = _ps.charPos; 4930chars = _ps.chars; 5096Debug.Assert(_ps.chars != null); 5097char[] chars = _ps.chars; 5098int attributeBaseEntityId = _ps.entityId; 5100LineInfo valueChunkLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 5113if (pos - _ps.charPos > 0) 5115_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5116_ps.charPos = pos; 5119if (chars[pos] == quoteChar && attributeBaseEntityId == _ps.entityId) 5134_ps.charPos++; 5143_stringBuilder.Append(_ps.eolNormalized ? "\u0020\u0020" : "\u0020"); // CDATA normalization of 0xD 0xA 5144_ps.charPos = pos; 5147else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5153_ps.charPos = pos; 5168_ps.charPos++; 5182if (pos - _ps.charPos > 0) 5184_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5186_ps.charPos = pos; 5188int enclosingEntityId = _ps.entityId; 5189LineInfo entityLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos + 1); 5197if (_parsingMode == ParsingMode.Full && _ps.entityId == attributeBaseEntityId) 5211_ps.charPos++; 5228valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5234_ps.charPos++; 5237pos = _ps.charPos; 5258Debug.Assert(_ps.entity != null); 5259entityChunk.SetNamedNode(XmlNodeType.EntityReference, _ps.entity.Name); 5267pos = _ps.charPos; 5270pos = _ps.charPos; 5273chars = _ps.chars; 5277if (pos == _ps.charsUsed) 5287if (pos + 1 == _ps.charsUsed) 5298ThrowInvalidChar(chars, _ps.charsUsed, pos); 5308if (_ps.charsUsed - _ps.charPos > 0) 5310if (_ps.chars[_ps.charPos] != (char)0xD) 5315Debug.Assert(_ps.isEof); 5323if (attributeBaseEntityId != _ps.entityId) 5337if (attributeBaseEntityId == _ps.entityId) 5340valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5345pos = _ps.charPos; 5346chars = _ps.chars; 5363_ps.charPos = pos + 1; 5401_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5419Debug.Assert(_ps.chars != null); 5420_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 5433_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5439_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5464Debug.Assert(_ps.chars != null); 5465_curNode.SetValueNode(XmlNodeType.Text, _ps.chars, startPos, endPos - startPos); 5474_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5481_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5539Debug.Assert(_ps.chars != null); 5540char[] chars = _ps.chars; 5541int pos = _ps.charPos; 5569if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 5571if (pos - _ps.charPos > 0) 5587_ps.charPos++; 5592else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5594if (!_ps.eolNormalized) 5632if (pos > _ps.charPos) 5653if (!XmlCharType.IsWhiteSpace(_ps.chars[pos - 1])) 5659pos = _ps.charPos; 5662chars = _ps.chars; 5666if (_ps.charsUsed - pos < 3 && !_ps.isEof) 5679if (pos == _ps.charsUsed) 5689if (pos + 1 == _ps.charsUsed) 5701int offset = pos - _ps.charPos; 5704pos = _ps.charPos + offset; 5709ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos + offset); 5716if (pos > _ps.charPos) 5723if (_ps.charsUsed - _ps.charPos > 0) 5725if (_ps.chars[_ps.charPos] != (char)0xD && _ps.chars[_ps.charPos] != ']') 5729Debug.Assert(_ps.isEof); 5748pos = _ps.charPos; 5749chars = _ps.chars; 5761startPos = _ps.charPos; 5763_ps.charPos = pos; 5782_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5784_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5904Debug.Assert(_ps.chars != null); 5908if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 5915_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5917if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 5929if (XmlCharType.IsCharData(_ps.chars[_ps.charPos])) 5935ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos); 5942Debug.Assert(_ps.chars != null); 5943Debug.Assert(_ps.chars[_ps.charPos] == '&'); 5944_ps.charPos++; 5946_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5952Debug.Assert(_ps.chars != null); 5953Debug.Assert(_ps.chars[_ps.charPos] == '&'); 5955if (_ps.charPos + 1 == _ps.charsUsed) 5964if (_ps.chars[_ps.charPos + 1] == '#') 5992_ps.charPos++; 5993int savedLinePos = _ps.LinePos; 6000Throw(SR.Xml_ErrorParsingEntityName, _ps.LineNo, savedLinePos); 6005if (_ps.chars[endPos] != ';') 6010int entityLinePos = _ps.LinePos; 6011string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 6012_ps.charPos = endPos + 1; 6016_reportedBaseUri = _ps.baseUriStr; 6017_reportedEncoding = _ps.encoding; 6043Throw(SR.Xml_UndeclaredEntity, name, _ps.LineNo, entityStartLinePos); 6057Throw(SR.Xml_UnparsedEntityRef, name, _ps.LineNo, entityStartLinePos); 6062Throw(SR.Xml_ExternalEntityInStandAloneDocument, entity.Name, _ps.LineNo, entityStartLinePos); 6069Throw(SR.Xml_ExternalEntityInAttValue, name, _ps.LineNo, entityStartLinePos); 6083_curNode.entityId = _ps.entityId; 6091_curNode.entityId = _ps.entityId; 6104_curNode.entityId = _ps.entityId; 6126if (_ps.entityResolvedManually) 6132if (_ps.entityId != _nodes[_index].entityId) 6138_lastEntity = _ps.entity; // save last entity for the EndEntity node 6147if (_ps.entityId != _nodes[_index].entityId) 6155_reportedEncoding = _ps.encoding; 6156_reportedBaseUri = _ps.baseUriStr; 6165_reportedEncoding = _ps.encoding; 6166_reportedBaseUri = _ps.baseUriStr; 6171_curNode.lineInfo.Set(_ps.lineNo, _ps.LinePos - 1); 6200_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6207Debug.Assert(_ps.chars != null); 6208string target = _nameTable.Add(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 6214_ps.charPos = nameEndPos; 6229char ch = _ps.chars[_ps.charPos]; 6230Debug.Assert(_ps.charPos < _ps.charsUsed); 6233if (_ps.charsUsed - _ps.charPos < 2) 6237if (ch != '?' || _ps.chars[_ps.charPos + 1] != '>') 6239Throw(SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(_ps.chars, _ps.charsUsed, _ps.charPos)); 6255_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 6260piInDtdStringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6283sb.Append(_ps.chars, startPos, endPos - startPos); 6285sb.Append(_ps.chars, startPos, endPos - startPos); 6300if (_ps.charsUsed - _ps.charPos < 2) 6304Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF, "PI"); 6308Debug.Assert(_ps.chars != null); 6309int pos = _ps.charPos; 6310char[] chars = _ps.chars; 6330Debug.Assert(!_ps.eolNormalized); 6338outStartPos = _ps.charPos; 6339_ps.charPos = pos + 2; 6342else if (pos + 1 == _ps.charsUsed) 6359if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6362if (pos - _ps.charPos > 0) 6378_ps.charPos++; 6383else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6385if (!_ps.eolNormalized) 6405if (pos == _ps.charsUsed) 6415if (pos + 1 == _ps.charsUsed) 6426ThrowInvalidChar(chars, _ps.charsUsed, pos); 6442outStartPos = _ps.charPos; 6443_ps.charPos = pos; 6476_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6480Debug.Assert(_ps.chars != null); 6481_curNode.SetValueNode(type, _ps.chars, startPos, endPos - startPos); 6487_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6490_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6504if (_ps.charsUsed - _ps.charPos < 3) 6513Debug.Assert(_ps.chars != null); 6514int pos = _ps.charPos; 6515char[] chars = _ps.chars; 6537Debug.Assert(!_ps.eolNormalized); 6545outStartPos = _ps.charPos; 6546_ps.charPos = pos + 3; 6549else if (pos + 2 == _ps.charsUsed) 6558else if (pos + 1 == _ps.charsUsed) 6578if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6580if (pos - _ps.charPos > 0) 6596_ps.charPos++; 6601else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6603if (!_ps.eolNormalized) 6623if (pos == _ps.charsUsed) 6631if (pos + 1 == _ps.charsUsed) 6642ThrowInvalidChar(chars, _ps.charsUsed, pos); 6657outStartPos = _ps.charPos; 6659_ps.charPos = pos; 6673while (_ps.charsUsed - _ps.charPos < 8) 6681if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("DOCTYPE")) 6686Debug.Assert(_ps.chars != null); 6687if (!XmlCharType.IsWhiteSpace(_ps.chars[_ps.charPos + 7])) 6689ThrowExpectingWhitespace(_ps.charPos + 7); 6694Throw(_ps.charPos - 2, SR.Xml_MultipleDTDsProvided); // position just before <!DOCTYPE 6699Throw(_ps.charPos - 2, SR.Xml_DtdAfterRootElement); 6702_ps.charPos += 8; 6708_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6745_ps.charPos = pos; 6751Debug.Assert(_ps.chars != null); 6752if (_ps.chars[_ps.charPos] == 'P') 6755while (_ps.charsUsed - _ps.charPos < 6) 6763if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("PUBLIC")) 6767_ps.charPos += 6; 6772ThrowExpectingWhitespace(_ps.charPos); 6781ThrowExpectingWhitespace(_ps.charPos); 6789else if (_ps.chars[_ps.charPos] == 'S') 6792while (_ps.charsUsed - _ps.charPos < 6) 6800if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("SYSTEM")) 6804_ps.charPos += 6; 6809ThrowExpectingWhitespace(_ps.charPos); 6817else if (_ps.chars[_ps.charPos] != '[' && _ps.chars[_ps.charPos] != '>') 6823if (_ps.chars[_ps.charPos] == '[') 6825_ps.charPos++; 6830if (_ps.chars[_ps.charPos] != '>') 6835else if (_ps.chars[_ps.charPos] == '>') 6843_ps.charPos++; 6848Debug.Assert(_ps.chars != null); 6850char quoteChar = _ps.chars[_ps.charPos]; 6856_ps.charPos++; 6867Debug.Assert(_ps.chars != null); 6868char[] chars = _ps.chars; 6869int pos = _ps.charPos; 6883_ps.charPos = pos + 1; 6888_ps.charPos = pos; 6901else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6927if (pos + 3 >= _ps.charsUsed && !_ps.isEof) 6942else if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 6952if (pos + 2 >= _ps.charsUsed && !_ps.isEof) 6970if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 7011if (pos == _ps.charsUsed) 7021if (pos + 1 == _ps.charsUsed) 7032ThrowInvalidChar(chars, _ps.charsUsed, pos); 7041if (_ps.charsUsed - _ps.charPos > 0) 7043if (_ps.chars[_ps.charPos] != (char)0xD) 7048Debug.Assert(_ps.isEof); 7055chars = _ps.chars; 7056pos = _ps.charPos; 7062int pos = _ps.charPos; 7064Debug.Assert(_ps.chars != null); 7065char[] chars = _ps.chars; 7080int tmp1 = pos - _ps.charPos; 7081if (sb != null && !_ps.eolNormalized) 7085sb.Append(chars, _ps.charPos, tmp1); 7088_ps.charPos = pos + 1; 7092else if (pos + 1 < _ps.charsUsed || _ps.isEof) 7094if (!_ps.eolNormalized) 7111if (pos == _ps.charsUsed) 7117int tmp2 = pos - _ps.charPos; 7120sb?.Append(_ps.chars, _ps.charPos, tmp2); 7121_ps.charPos = pos; 7130int tmp3 = pos - _ps.charPos; 7133sb?.Append(_ps.chars, _ps.charPos, tmp3); 7134_ps.charPos = pos; 7140if (_ps.charsUsed - _ps.charPos == 0) 7144if (_ps.chars[_ps.charPos] != (char)0xD) 7149Debug.Assert(_ps.isEof); 7151pos = _ps.charPos; 7152chars = _ps.chars; 7158Debug.Assert(_ps.chars != null); 7159Debug.Assert(_ps.chars[startPos] == '&'); 7160if (_ps.chars[startPos + 1] == '#') 7183switch (newPos = ParseNumericCharRefInline(_ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType)) 7192Debug.Assert(_ps.chars != null); 7193Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7198_ps.charPos = newPos - charCount; 7213Debug.Assert(_ps.chars != null); 7214Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#'); 7222chars = _ps.chars; 7244else if (pos < _ps.charsUsed) 7264_ps.charPos = pos; 7273if (pos == _ps.charsUsed) 7291Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(ch, '\0')); 7296internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7317Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, SR.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(high, low)); 7324internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7344switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder)) 7355Debug.Assert(_ps.chars != null); 7356Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7361_ps.charPos = newPos - 1; 7376Debug.Assert(startPos < _ps.charsUsed); 7377Debug.Assert(_ps.chars != null); 7378Debug.Assert(_ps.chars[startPos] == '&'); 7379Debug.Assert(_ps.chars[startPos + 1] != '#'); 7382char[] chars = _ps.chars; 7393if (_ps.charsUsed - pos >= 3) 7410if (_ps.charsUsed - pos >= 4) 7425else if (pos < _ps.charsUsed) 7432if (_ps.charsUsed - pos >= 5) 7449if (_ps.charsUsed - pos >= 3) 7465if (_ps.charsUsed - pos >= 3) 7490internalSubsetBuilder?.Append(_ps.chars, _ps.charPos, pos - _ps.charPos); 7491_ps.chars[pos - 1] = ch; 7509int pos = _ps.charPos + startOffset; 7512Debug.Assert(_ps.chars != null); 7513char[] chars = _ps.chars; 7522if (pos + 1 >= _ps.charsUsed) 7532Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 7559colonOffset = pos - _ps.charPos; 7565colonOffset = pos - _ps.charPos; 7571else if (pos == _ps.charsUsed) 7575Debug.Assert(_ps.chars != null); 7576chars = _ps.chars; 7583colonPos = (colonOffset == -1) ? -1 : _ps.charPos + colonOffset; 7589int offset = pos - _ps.charPos; 7591pos = _ps.charPos + offset; 7608Debug.Assert(_ps.chars != null); 7611if (_ps.chars[endPos] != ';') 7616string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 7617_ps.charPos = endPos + 1; 7661Debug.Assert(_ps.chars != null); 7666string localName = _nameTable.Add(_ps.chars, _ps.charPos, endNamePos - _ps.charPos); 7672int startPos = _ps.charPos; 7674if (prefixLen == _lastPrefix.Length && _ps.chars.AsSpan(_ps.charPos).StartsWith(_lastPrefix)) 7676return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7682string prefix = _nameTable.Add(_ps.chars, startPos, prefixLen); 7684return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7743_ps.lineNo++; 7744_ps.lineStartPos = pos - 1; 7749Debug.Assert(_ps.isEof); 7752_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8002Debug.Assert(_ps.appendMode); 8003int initialPos = _ps.charPos; 8011_ps.charPos = initialPos; 8018Encoding? enc = _ps.encoding; 8035Encoding? enc = _ps.encoding; 8043_ps.lineNo = entity.LineNumber; 8044_ps.lineStartPos = -entity.LinePosition - 1; 8046_ps.eolNormalized = true; 8053_ps.stream?.Dispose(); 8057_curNode.entityId = _ps.entityId; 8073_ps.entity = entity; 8074_ps.entityId = _nextEntityId++; 8088if (_ps.entity != null) 8090_currentEntities!.Remove(_ps.entity); 8108_parsingStatesStack[_parsingStatesStackTop] = _ps; 8110_ps.Clear(); 8117_ps.Close(true); 8129_incReadLeftStartPos = _ps.charPos; 8130_incReadLeftEndPos = _ps.charPos; 8131_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8174Debug.Assert(_ps.chars != null); 8184count = _incReadDecoder.Decode(_ps.chars, _incReadLeftStartPos, charsLeft); 8223Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 2).StartsWith("?>")); 8224_ps.charPos -= 2; 8231Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("-->")); 8232_ps.charPos -= 3; 8239Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("]]>")); 8240_ps.charPos -= 3; 8268char[] chars = _ps.chars; 8269startPos = _ps.charPos; 8274_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8315else if (pos + 1 < _ps.charsUsed) 8332if (_ps.charsUsed - pos < 2) 8345if (_ps.charsUsed - pos < 4) 8355if (_ps.charsUsed - pos < 9) 8373Debug.Assert(_ps.charPos - pos == 0); 8374Debug.Assert(_ps.charPos - startPos == 0); 8379if ((endPos - _ps.charPos - 2) == checkName.Length && chars.AsSpan(_ps.charPos + 2).StartsWith(checkName) && 8380(_ps.chars[endPos] == '>' || XmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8388_ps.charPos = endPos; 8389if (XmlCharType.IsWhiteSpace(_ps.chars[endPos])) 8393if (_ps.chars[_ps.charPos] != '>') 8397_ps.charPos++; 8405startPos = _ps.charPos; 8406chars = _ps.chars; 8413Debug.Assert(_ps.charPos - pos == 0); 8414Debug.Assert(_ps.charPos - startPos == 0); 8418if (endPos - _ps.charPos - 1 == _curNode.localName.Length && _ps.chars.AsSpan(_ps.charPos + 1).StartsWith(_curNode.localName) && 8419(_ps.chars[endPos] == '>' || _ps.chars[endPos] == '/' || XmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8427startPos = _ps.charPos; 8428chars = _ps.chars; 8437if (_ps.charsUsed - pos < 2) 8476if (pos == _ps.charsUsed) 8493_ps.charPos = pos; 8503count = _incReadDecoder.Decode(_ps.chars, startPos, charsParsed); 8541ParseAttributeValueSlow(_ps.charPos, ' ', _curNode); // The quote char is intentionally empty (space) because we need to parse ' and " into the attribute value 8564Debug.Assert(_ps.chars != null); 8566char[] chars = _ps.chars; 8567int pos = _ps.charPos; 8570_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8590Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!"); 8613if (pos - _ps.charPos > 0) 8615_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8618_ps.charPos = pos; 8626chars = _ps.chars; 8627if (_normalize && XmlCharType.IsWhiteSpace(chars[_ps.charPos]) && pos - _ps.charPos == 1) 8629chars[_ps.charPos] = (char)0x20; // CDATA normalization of character references in entities 8636_ps.charPos++; 8648chars = _ps.chars; 8652if (pos == _ps.charsUsed) 8662if (pos + 1 == _ps.charsUsed) 8675ThrowInvalidChar(chars, _ps.charsUsed, pos); 8681if (pos - _ps.charPos > 0) 8683_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8684_ps.charPos = pos; 8708pos = _ps.charPos; 8709chars = _ps.chars; 8713if (pos - _ps.charPos > 0) 8715_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8716_ps.charPos = pos; 8748_ps.charPos = pos; 8772_ps.charPos = pos; 8778if (_ps.charPos == _ps.charsUsed) 8783Debug.Assert(_ps.chars != null); 8785if (XmlCharType.IsNCNameSingleChar(_ps.chars[_ps.charPos])) 8787int pos = _ps.charPos + 1; 8788while (XmlCharType.IsNCNameSingleChar(_ps.chars[pos])) 8792return new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 8796Debug.Assert(_ps.charPos < _ps.charsUsed); 8797return new string(_ps.chars, _ps.charPos, 1); 8861Debug.Assert(_ps.chars != null); 8863if (_v1Compat && pos == _ps.charsUsed - 1 && _ps.chars[pos] == (char)0 && ReadData() == 0 && _ps.isStreamEof) 8865_ps.charsUsed--; 9371_curNode.AdjustLineInfo(_readValueOffset, _ps.eolNormalized, ref _incReadLineInfo); 9385Debug.Assert(_ps.chars != null); 9396_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 9401charsRead = _incReadDecoder.Decode(_ps.chars, startPos, endPos - startPos); 9416_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 9418AdjustLineInfo(_ps.chars, startPos - charsRead, startPos, _ps.eolNormalized, ref _incReadLineInfo);
System\Xml\Core\XmlTextReaderImplAsync.cs (656)
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) 1043char[] newChars = new char[_ps.chars.Length * 2]; 1044BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 1045_ps.chars = newChars; 1048if (_ps.stream != null) 1051if (_ps.bytesUsed - _ps.bytePos < MaxByteSequenceLen) 1053if (_ps.bytes!.Length - _ps.bytesUsed < MaxByteSequenceLen) 1055byte[] newBytes = new byte[_ps.bytes.Length * 2]; 1056BlockCopy(_ps.bytes, 0, newBytes, 0, _ps.bytesUsed); 1057_ps.bytes = newBytes; 1062charsRead = _ps.chars.Length - _ps.charsUsed - 1; 1070int charsLen = _ps.chars.Length; 1071if (charsLen - _ps.charsUsed <= charsLen / 2) 1080int copyCharsCount = _ps.charsUsed - _ps.charPos; 1083_ps.lineStartPos -= _ps.charPos; 1086BlockCopyChars(_ps.chars, _ps.charPos, _ps.chars, 0, copyCharsCount); 1088_ps.charPos = 0; 1089_ps.charsUsed = copyCharsCount; 1093char[] newChars = new char[_ps.chars.Length * 2]; 1094BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 1095_ps.chars = newChars; 1099if (_ps.stream != null) 1102int bytesLeft = _ps.bytesUsed - _ps.bytePos; 1107_ps.bytesUsed = 0; 1111BlockCopy(_ps.bytes!, _ps.bytePos, _ps.bytes!, 0, bytesLeft); 1112_ps.bytesUsed = bytesLeft; 1114_ps.bytePos = 0; 1117charsRead = _ps.chars.Length - _ps.charsUsed - 1; 1120if (_ps.stream != null) 1122if (!_ps.isStreamEof) 1125if (_ps.bytePos == _ps.bytesUsed && _ps.bytes!.Length - _ps.bytesUsed > 0) 1127int read = await _ps.stream.ReadAsync(_ps.bytes.AsMemory(_ps.bytesUsed)).ConfigureAwait(false); 1130_ps.isStreamEof = true; 1132_ps.bytesUsed += read; 1136int originalBytePos = _ps.bytePos; 1140if (charsRead == 0 && _ps.bytePos != originalBytePos) 1146else if (_ps.textReader != null) 1149charsRead = await _ps.textReader.ReadAsync(_ps.chars.AsMemory(_ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1)).ConfigureAwait(false); 1150_ps.charsUsed += charsRead; 1161Debug.Assert(_ps.charsUsed < _ps.chars.Length); 1162_ps.isEof = true; 1164_ps.chars[_ps.charsUsed] = (char)0; 1171while (_ps.charsUsed - _ps.charPos < 6) 1179if (!_ps.chars.AsSpan(_ps.charPos).StartsWith(XmlDeclarationBeginning) || 1180XmlCharType.IsNameSingleChar(_ps.chars[_ps.charPos + 5])) 1187_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos + 2); 1190_ps.charPos += 5; 1206if (_ps.chars[_ps.charPos] == '?') 1210if (_ps.chars[_ps.charPos + 1] == '>') 1217_ps.charPos += 2; 1238string encodingName = _ps.encoding!.WebName; 1240encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 1242Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 1245if (_ps.decoder is SafeAsciiDecoder) 1254_ps.appendMode = false; 1257else if (_ps.charPos + 1 == _ps.charsUsed) 1276switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 1313attr!.SetLineInfo(_ps.LineNo, _ps.LinePos); 1315sb.Append(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 1316_ps.charPos = nameEndPos; 1319if (_ps.chars[_ps.charPos] != '=') 1322if (_ps.chars[_ps.charPos] != '=') 1328_ps.charPos++; 1330char quoteChar = _ps.chars[_ps.charPos]; 1334quoteChar = _ps.chars[_ps.charPos]; 1341_ps.charPos++; 1345attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 1349int pos = _ps.charPos; 1352chars = _ps.chars; 1359if (_ps.chars[pos] == quoteChar) 1366if (_ps.chars.AsSpan(_ps.charPos).StartsWith("1.0")) 1370attr!.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 1376string badVersion = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 1381string encName = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 1390switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 1400Throw(SR.Xml_InvalidXmlDecl, _ps.LineNo, _ps.LinePos - 1); 1405attr!.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 1413sb.Append(chars, _ps.charPos, pos - _ps.charPos); 1415_ps.charPos = pos + 1; 1418else if (pos == _ps.charsUsed) 1435if (_ps.isEof || await ReadDataAsync().ConfigureAwait(false) == 0) 1451string encodingName = _ps.encoding!.WebName; 1453encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 1455Throw(SR.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 1458if (_ps.decoder is SafeAsciiDecoder) 1462_ps.appendMode = false; 1474int pos = _ps.charPos; 1475char[] chars = _ps.chars; 1481if (_ps.charsUsed - pos < 4) // minimum "<a/>" 1488_ps.charPos = pos + 1; 1492if (_ps.charsUsed - pos < 2) // minimum characters expected "--" 1499_ps.charPos = pos + 2; 1513if (_ps.charsUsed - pos < 6) 1519_ps.charPos = pos + 6; 1529Throw(_ps.charPos, SR.Xml_InvalidRootData); 1538_ps.charPos = pos; 1570_ps.charPos = pos; 1580else if (pos == _ps.charsUsed || (_v1Compat && chars[pos] == 0x0)) 1597Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 1612int pos = _ps.charPos; 1733int pos = _ps.charPos; 1734char[] chars = _ps.chars; 1744_ps.charPos = pos + 2; 1748if (_ps.charsUsed - pos < 2) 1755_ps.charPos = pos + 2; 1767if (_ps.charsUsed - pos < 6) 1773_ps.charPos = pos + 6; 1795_ps.charPos = pos + 2; 1799if (pos + 1 == _ps.charsUsed) 1806_ps.charPos = pos + 1; 1815if (pos == _ps.charsUsed) 1833if (_ps.charsUsed - _ps.charPos != 0) 1858int pos = _ps.charPos; 1859char[] chars = _ps.chars; 1862_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 1913else if (pos + 1 < _ps.charsUsed) 1951char[] chars = _ps.chars; 1960_nameTable.Add(chars, _ps.charPos, pos - _ps.charPos)); 1964int startPos = _ps.charPos; 1977_nameTable.Add(chars, _ps.charPos, prefixLen), 1989_ps.charPos = pos; 2003int pos = _ps.charPos; 2004char[] chars = _ps.chars; 2009_ps.charPos = pos + 1; 2015if (pos + 1 == _ps.charsUsed) 2017_ps.charPos = pos; 2025_ps.charPos = pos + 2; 2035Throw(pos, SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 2067if (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 2089while (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 2105char[] chars = _ps.chars; 2108if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.localName)) 2116int colonPos = _ps.charPos + prefLen; 2117if (!chars.AsSpan(_ps.charPos).StartsWith(startTagNode.prefix) || 2125LineInfo endTagLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 2187pos = _ps.charPos + nameLen; 2188chars = _ps.chars; 2190if (pos == _ps.charsUsed) 2225else if (pos == _ps.charsUsed && !_ps.isEof) 2239else if (pos == _ps.charsUsed) 2260_ps.charPos = pos + 1; 2294args[3] = new string(_ps.chars, _ps.charPos, endPos - _ps.charPos); 2307int pos = _ps.charPos; 2308char[] chars = _ps.chars; 2334else if (pos + 1 != _ps.charsUsed) 2341_ps.charPos = pos; 2362_ps.charPos = pos + 1; 2370if (pos + 1 == _ps.charsUsed) 2376_ps.charPos = pos + 2; 2387else if (pos == _ps.charsUsed) 2393Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 2397if (pos == _ps.charPos) 2401_ps.charPos = pos; 2404int attrNameLinePos = _ps.LinePos; 2407int attrNameLineNo = _ps.LineNo; 2466chars = _ps.chars; 2469else if (pos + 1 >= _ps.charsUsed) 2476chars = _ps.chars; 2480attr.SetLineInfo(_ps.LineNo, attrNameLinePos); 2483Debug.Assert(attrNameLineNo == _ps.LineNo); 2489_ps.charPos = pos; 2491pos = _ps.charPos; 2502_ps.charPos = pos; 2504pos = _ps.charPos; 2512_ps.charPos = pos; 2515attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 2529string val = new string(chars, _ps.charPos, pos - _ps.charPos); 2533attr.SetValue(chars, _ps.charPos, pos - _ps.charPos); 2535_ps.charPos = pos; 2540pos = _ps.charPos; 2541chars = _ps.chars; 2569_ps.lineNo -= lineNoDelta; 2572pos = _ps.charPos; 2573chars = _ps.chars; 2606char[] chars = _ps.chars; 2607int attributeBaseEntityId = _ps.entityId; 2610LineInfo valueChunkLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 2623if (pos - _ps.charPos > 0) 2625_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 2626_ps.charPos = pos; 2629if (chars[pos] == quoteChar && attributeBaseEntityId == _ps.entityId) 2644_ps.charPos++; 2653_stringBuilder.Append(_ps.eolNormalized ? "\u0020\u0020" : "\u0020"); // CDATA normalization of 0xD 0xA 2654_ps.charPos = pos; 2657else if (pos + 1 < _ps.charsUsed || _ps.isEof) 2663_ps.charPos = pos; 2678_ps.charPos++; 2692if (pos - _ps.charPos > 0) 2694_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 2696_ps.charPos = pos; 2699int enclosingEntityId = _ps.entityId; 2700LineInfo entityLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos + 1); 2713if (_parsingMode == ParsingMode.Full && _ps.entityId == attributeBaseEntityId) 2727_ps.charPos++; 2744valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 2750_ps.charPos++; 2753pos = _ps.charPos; 2774entityChunk.SetNamedNode(XmlNodeType.EntityReference, _ps.entity!.Name); 2782pos = _ps.charPos; 2785pos = _ps.charPos; 2788chars = _ps.chars; 2792if (pos == _ps.charsUsed) 2802if (pos + 1 == _ps.charsUsed) 2813ThrowInvalidChar(chars, _ps.charsUsed, pos); 2823if (_ps.charsUsed - _ps.charPos > 0) 2825if (_ps.chars[_ps.charPos] != (char)0xD) 2830Debug.Assert(_ps.isEof); 2838if (attributeBaseEntityId != _ps.entityId) 2853if (attributeBaseEntityId == _ps.entityId) 2856valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 2861pos = _ps.charPos; 2862chars = _ps.chars; 2880_ps.charPos = pos + 1; 2898_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 2930_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 2966_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 2989_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 3004_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3015_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3040_curNode.SetValueNode(XmlNodeType.Text, _ps.chars, startPos, endPos - startPos); 3049_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3062_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3169Task<(int, int, int, bool)> task = ParseTextAsync(outOrChars, _ps.chars, _ps.charPos, 0, -1, outOrChars); 3268if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 3270if (pos - _ps.charPos > 0) 3286_ps.charPos++; 3291else if (pos + 1 < _ps.charsUsed || _ps.isEof) 3293if (!_ps.eolNormalized) 3318if (_ps.charsUsed - pos < 3 && !_ps.isEof) 3333if (pos == _ps.charsUsed) 3373if (pos > _ps.charPos) 3403if (!XmlCharType.IsWhiteSpace(_ps.chars[pos - 1])) 3409pos = _ps.charPos; 3412chars = _ps.chars; 3425if (pos + 1 == _ps.charsUsed) 3441int offset = pos - _ps.charPos; 3444chars = _ps.chars; 3445pos = _ps.charPos + offset; 3452ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos + offset); 3460if (pos > _ps.charPos) 3469if (_ps.charsUsed - _ps.charPos > 0) 3471if (_ps.chars[_ps.charPos] != (char)0xD && _ps.chars[_ps.charPos] != ']') 3475Debug.Assert(_ps.isEof); 3499pos = _ps.charPos; 3500chars = _ps.chars; 3517int startPos = _ps.charPos; 3519_ps.charPos = pos; 3546_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3553_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3684if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || await ZeroEndingStreamAsync(_ps.charPos).ConfigureAwait(false)) 3691_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3693if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || await ZeroEndingStreamAsync(_ps.charPos).ConfigureAwait(false)) 3705if (XmlCharType.IsCharData(_ps.chars[_ps.charPos])) 3711ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos); 3718Debug.Assert(_ps.chars[_ps.charPos] == '&'); 3719_ps.charPos++; 3721_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3729Debug.Assert(_ps.chars[_ps.charPos] == '&'); 3731if (_ps.charPos + 1 == _ps.charsUsed) 3740if (_ps.chars[_ps.charPos + 1] == '#') 3775_ps.charPos++; 3776int savedLinePos = _ps.LinePos; 3783Throw(SR.Xml_ErrorParsingEntityName, _ps.LineNo, savedLinePos); 3789if (_ps.chars[endPos] != ';') 3794int entityLinePos = _ps.LinePos; 3795string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 3796_ps.charPos = endPos + 1; 3800_reportedBaseUri = _ps.baseUriStr; 3801_reportedEncoding = _ps.encoding; 3829Throw(SR.Xml_UndeclaredEntity, name, _ps.LineNo, entityStartLinePos); 3842Throw(SR.Xml_UnparsedEntityRef, name, _ps.LineNo, entityStartLinePos); 3847Throw(SR.Xml_ExternalEntityInStandAloneDocument, entity.Name, _ps.LineNo, entityStartLinePos); 3854Throw(SR.Xml_ExternalEntityInAttValue, name, _ps.LineNo, entityStartLinePos); 3868_curNode.entityId = _ps.entityId; 3876_curNode.entityId = _ps.entityId; 3889_curNode.entityId = _ps.entityId; 3905_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 3912string target = _nameTable.Add(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 3918_ps.charPos = nameEndPos; 3933char ch = _ps.chars[_ps.charPos]; 3934Debug.Assert(_ps.charPos < _ps.charsUsed); 3937if (_ps.charsUsed - _ps.charPos < 2) 3941if (ch != '?' || _ps.chars[_ps.charPos + 1] != '>') 3943Throw(SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(_ps.chars, _ps.charsUsed, _ps.charPos)); 3964_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 3969piInDtdStringBuilder.Append(_ps.chars, startPos, endPos - startPos); 3999sb.Append(_ps.chars, startPos, endPos - startPos); 4006sb.Append(_ps.chars, startPos, endPos - startPos); 4023if (_ps.charsUsed - _ps.charPos < 2) 4027Throw(_ps.charsUsed, SR.Xml_UnexpectedEOF, "PI"); 4031int pos = _ps.charPos; 4032char[] chars = _ps.chars; 4053Debug.Assert(!_ps.eolNormalized); 4061outStartPos = _ps.charPos; 4062_ps.charPos = pos + 2; 4066else if (pos + 1 == _ps.charsUsed) 4083if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 4086if (pos - _ps.charPos > 0) 4102_ps.charPos++; 4107else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4109if (!_ps.eolNormalized) 4129if (pos == _ps.charsUsed) 4139if (pos + 1 == _ps.charsUsed) 4150ThrowInvalidChar(chars, _ps.charsUsed, pos); 4166outStartPos = _ps.charPos; 4167_ps.charPos = pos; 4201_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4210_curNode.SetValueNode(type, _ps.chars, startPos, endPos - startPos); 4218_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 4225_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 4247if (_ps.charsUsed - _ps.charPos < 3) 4256int pos = _ps.charPos; 4257char[] chars = _ps.chars; 4279Debug.Assert(!_ps.eolNormalized); 4287outStartPos = _ps.charPos; 4288_ps.charPos = pos + 3; 4292else if (pos + 2 == _ps.charsUsed) 4301else if (pos + 1 == _ps.charsUsed) 4321if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 4323if (pos - _ps.charPos > 0) 4339_ps.charPos++; 4344else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4346if (!_ps.eolNormalized) 4366if (pos == _ps.charsUsed) 4374if (pos + 1 == _ps.charsUsed) 4385ThrowInvalidChar(chars, _ps.charsUsed, pos); 4400outStartPos = _ps.charPos; 4402_ps.charPos = pos; 4417while (_ps.charsUsed - _ps.charPos < 8) 4424if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("DOCTYPE")) 4428if (!XmlCharType.IsWhiteSpace(_ps.chars[_ps.charPos + 7])) 4430ThrowExpectingWhitespace(_ps.charPos + 7); 4435Throw(_ps.charPos - 2, SR.Xml_MultipleDTDsProvided); // position just before <!DOCTYPE 4439Throw(_ps.charPos - 2, SR.Xml_DtdAfterRootElement); 4442_ps.charPos += 8; 4449_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4491_ps.charPos = pos; 4497if (_ps.chars[_ps.charPos] == 'P') 4500while (_ps.charsUsed - _ps.charPos < 6) 4508if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("PUBLIC")) 4512_ps.charPos += 6; 4517ThrowExpectingWhitespace(_ps.charPos); 4526ThrowExpectingWhitespace(_ps.charPos); 4534else if (_ps.chars[_ps.charPos] == 'S') 4537while (_ps.charsUsed - _ps.charPos < 6) 4545if (!_ps.chars.AsSpan(_ps.charPos).StartsWith("SYSTEM")) 4549_ps.charPos += 6; 4554ThrowExpectingWhitespace(_ps.charPos); 4562else if (_ps.chars[_ps.charPos] != '[' && _ps.chars[_ps.charPos] != '>') 4568if (_ps.chars[_ps.charPos] == '[') 4570_ps.charPos++; 4575if (_ps.chars[_ps.charPos] != '>') 4580else if (_ps.chars[_ps.charPos] == '>') 4588_ps.charPos++; 4594char quoteChar = _ps.chars[_ps.charPos]; 4600_ps.charPos++; 4611char[] chars = _ps.chars; 4612int pos = _ps.charPos; 4626_ps.charPos = pos + 1; 4631_ps.charPos = pos; 4644else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4670if (pos + 3 >= _ps.charsUsed && !_ps.isEof) 4685else if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 4695if (pos + 2 >= _ps.charsUsed && !_ps.isEof) 4713if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 4754if (pos == _ps.charsUsed) 4764if (pos + 1 == _ps.charsUsed) 4775ThrowInvalidChar(chars, _ps.charsUsed, pos); 4784if (_ps.charsUsed - _ps.charPos > 0) 4786if (_ps.chars[_ps.charPos] != (char)0xD) 4791Debug.Assert(_ps.isEof); 4798chars = _ps.chars; 4799pos = _ps.charPos; 4805int pos = _ps.charPos; 4807char[] chars = _ps.chars; 4822int tmp1 = pos - _ps.charPos; 4823if (sb != null && !_ps.eolNormalized) 4827sb.Append(chars, _ps.charPos, tmp1); 4830_ps.charPos = pos + 1; 4834else if (pos + 1 < _ps.charsUsed || _ps.isEof) 4836if (!_ps.eolNormalized) 4853if (pos == _ps.charsUsed) 4859int tmp2 = pos - _ps.charPos; 4862sb?.Append(_ps.chars, _ps.charPos, tmp2); 4863_ps.charPos = pos; 4872int tmp3 = pos - _ps.charPos; 4875sb?.Append(_ps.chars, _ps.charPos, tmp3); 4876_ps.charPos = pos; 4882if (_ps.charsUsed - _ps.charPos == 0) 4886if (_ps.chars[_ps.charPos] != (char)0xD) 4891Debug.Assert(_ps.isEof); 4893pos = _ps.charPos; 4894chars = _ps.chars; 4912switch (newPos = ParseNumericCharRefInline(_ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType)) 4920Debug.Assert(_ps.chars[_ps.charPos] == '&'); 4925_ps.charPos = newPos - charCount; 4944switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder)) 4954Debug.Assert(_ps.chars[_ps.charPos] == '&'); 4959_ps.charPos = newPos - 1; 4982int pos = _ps.charPos + startOffset; 4985char[] chars = _ps.chars; 4994if (pos + 1 >= _ps.charsUsed) 5007Throw(pos, SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 5034colonOffset = pos - _ps.charPos; 5040colonOffset = pos - _ps.charPos; 5046else if (pos == _ps.charsUsed) 5053chars = _ps.chars; 5060colonPos = (colonOffset == -1) ? -1 : _ps.charPos + colonOffset; 5067int offset = pos - _ps.charPos; 5069pos = _ps.charPos + offset; 5088if (_ps.chars[endPos] != ';') 5093string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 5094_ps.charPos = endPos + 1; 5211Debug.Assert(_ps.appendMode); 5212int initialPos = _ps.charPos; 5219_ps.charPos = initialPos; 5225Encoding? enc = _ps.encoding; 5245if (_v1Compat && pos == _ps.charsUsed - 1 && _ps.chars[pos] == (char)0 && await ReadDataAsync().ConfigureAwait(false) == 0 && _ps.isStreamEof) 5247_ps.charsUsed--; 5379_curNode.AdjustLineInfo(_readValueOffset, _ps.eolNormalized, ref _incReadLineInfo); 5403_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 5413charsRead = _incReadDecoder.Decode(_ps.chars, startPos, endPos - startPos); 5427_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 5429AdjustLineInfo(_ps.chars, startPos - charsRead, startPos, _ps.eolNormalized, ref _incReadLineInfo);