1 write to _ps
dotnet-svcutil-lib (1)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (1)
8261_ps = _parsingStatesStack[_parsingStatesStackTop--];
1014 references to _ps
dotnet-svcutil-lib (1014)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (1014)
364_ps.lineNo = 1; 365_ps.lineStartPos = -1; 428_ps.lineNo = _lineNumberOffset + 1; 429_ps.lineStartPos = -_linePositionOffset - 1; 430_curNode.SetLineInfo(_ps.LineNo - 1, _ps.LinePos - 1); 484_reportedBaseUri = _ps.baseUriStr; 485_reportedEncoding = _ps.encoding; 504_reportedEncoding = _ps.encoding; 528_reportedBaseUri = _ps.baseUriStr; 529_reportedEncoding = _ps.encoding; 552_reportedEncoding = _ps.encoding; 595_ps.baseUri = GetTempResolver().ResolveUri(null, url); 596_ps.baseUriStr = _ps.baseUri.ToString(); 597_reportedBaseUri = _ps.baseUriStr; 682_reportedEncoding = _ps.encoding; 756_reportedEncoding = _ps.encoding; 805_reportedEncoding = _ps.encoding; 824_reportedBaseUri = _ps.baseUriStr; 825_reportedEncoding = _ps.encoding; 1245Debug.Assert(!_ps.appendMode); 1254_reportedEncoding = _ps.encoding; 1257_reportedEncoding = _ps.encoding; 1294_reportedEncoding = _ps.encoding; 1295_reportedBaseUri = _ps.baseUriStr; 1301_curNode.SetLineInfo(_ps.lineNo, _ps.LinePos); 1302_reportedEncoding = _ps.encoding; 1303_reportedBaseUri = _ps.baseUriStr; 1474_attributeValueBaseEntityId = _ps.entityId; 1479if (_ps.entityId == _attributeValueBaseEntityId) 1515if (_ps.charsUsed - _ps.charPos == 0) 1536if (_ps.charsUsed - _ps.charPos == 0 && !_ps.entity.IsExternal) 1554_ps.entityResolvedManually = true; 1938BlockCopyChars(_ps.chars, startPos, buffer, (index + readCount), copyCount); 1961_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 2083if (_ps.entity == null || _ps.entity.IsExternal) 2085_ps.eolNormalized = !value; 2174_ps.baseUri = null; 2240_stringBuilder.Append(_ps.chars, _incReadLeftStartPos, _incReadLeftEndPos - _incReadLeftStartPos); 2250_ps.appendMode = false; 2253_stringBuilder.Append(_ps.chars, _ps.charPos, _ps.charsUsed - _ps.charPos); 2254_ps.charPos = _ps.charsUsed; 2439if (_ps.baseUriStr.Length > 0 && _ps.baseUri == null && _xmlResolver != null) 2441_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2443return _ps.baseUri; 2451return _ps.isEof; 2459return _ps.chars; 2467return _ps.charsUsed; 2475return _ps.charPos; 2479Debug.Assert(value >= 0 && value <= _ps.charsUsed); 2480_ps.charPos = value; 2496return _ps.eolNormalized; 2521return _ps.LineNo; 2529return _ps.lineStartPos; 2590if (e.ResString == ResXml.Xml_UnexpectedEOF && _ps.entity != null) 2592SendValidationEvent(XmlSeverityType.Error, ResXml.Sch_ParEntityRefNesting, null, _ps.LineNo, _ps.LinePos); 2631entityId = _ps.entityId; 2643oldEntity = _ps.entity; 2645newEntityId = _ps.entityId; 2662if (_ps.baseUri == null && !string.IsNullOrEmpty(_ps.baseUriStr)) 2664_ps.baseUri = _xmlResolver.ResolveUri(null, _ps.baseUriStr); 2666PushExternalEntityOrSubset(publicId, systemId, _ps.baseUri, null); 2668_ps.entity = null; 2669_ps.entityId = 0; 2671Debug.Assert(_ps.appendMode); 2672int initialPos = _ps.charPos; 2679_ps.charPos = initialPos; 2695_ps.entity = null; 2696_ps.entityId = 0; 2697_ps.eolNormalized = false; 2726_ps.charPos = pos; 2732_ps.charPos = pos; 2738_ps.charPos = pos; 2749Throw(new XmlException(res, string.Empty, lineNo, linePos, _ps.baseUriStr)); 2754Throw(new XmlException(res, arg, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2759Throw(new XmlException(res, arg, lineNo, linePos, _ps.baseUriStr)); 2764Throw(new XmlException(res, args, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2774Throw(new XmlException(res, args, innerException, _ps.LineNo, _ps.LinePos, _ps.baseUriStr)); 2790Throw(new XmlException(e.Message, (Exception)null, lineNo, linePos, _ps.baseUriStr)); 2795Throw(new XmlException(res, string.Empty, _ps.baseUriStr)); 2800Throw(new XmlException(res, arg, _ps.baseUriStr)); 2805Throw(new XmlException(res, args, innerException, 0, 0, _ps.baseUriStr)); 2821SendValidationEvent(severity, new XmlSchemaException(code, arg, _ps.baseUriStr, lineNo, linePos)); 2856while (_ps.entityId != _attributeValueBaseEntityId) 2898Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 2902_ps.stream = stream; 2903_ps.baseUri = baseUri; 2904_ps.baseUriStr = baseUriStr; 2910_ps.bytes = bytes; 2911_ps.bytesUsed = byteCount; 2912bufferSize = _ps.bytes.Length; 2927if (_ps.bytes == null || _ps.bytes.Length < bufferSize) 2929_ps.bytes = new byte[bufferSize]; 2934if (_ps.chars == null || _ps.chars.Length < bufferSize + 1) 2936_ps.chars = new char[bufferSize + 1]; 2940_ps.bytePos = 0; 2941while (_ps.bytesUsed < 4 && _ps.bytes.Length - _ps.bytesUsed > 0) 2943int read = stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed); 2946_ps.isStreamEof = true; 2949_ps.bytesUsed += read; 2960byte[] preamble = _ps.encoding.GetPreamble(); 2963for (i = 0; i < preambleLen && i < _ps.bytesUsed; i++) 2965if (_ps.bytes[i] != preamble[i]) 2972_ps.bytePos = preambleLen; 2975_documentStartBytePos = _ps.bytePos; 2977_ps.eolNormalized = !_normalize; 2980_ps.appendMode = true; 2991Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 2994_ps.textReader = input; 2995_ps.baseUriStr = baseUriStr; 2996_ps.baseUri = baseUri; 2998if (_ps.chars == null) 3001_ps.chars = new char[XmlReader.DefaultBufferSize + 1]; 3012_ps.encoding = Encoding.Unicode; 3013_ps.eolNormalized = !_normalize; 3016_ps.appendMode = true; 3022Debug.Assert(_ps.stream == null && _ps.textReader == null); 3023Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0); 3027_ps.baseUriStr = baseUriStr; 3028_ps.baseUri = null; 3031_ps.chars = new char[len + 1]; 3032str.CopyTo(0, _ps.chars, 0, str.Length); 3033_ps.charsUsed = len; 3034_ps.chars[len] = (char)0; 3036_ps.encoding = originalEncoding; 3038_ps.eolNormalized = !_normalize; 3039_ps.isEof = true; 3058_ps.baseUriStr = parserContext.BaseURI; 3059_ps.baseUri = null; 3066_ps.baseUriStr = string.Empty; 3067_ps.baseUri = null; 3070_reportedBaseUri = _ps.baseUriStr; 3075_ps.appendMode = false; 3090_ps.appendMode = false; 3138if (_ps.baseUri != null) 3144_ps.baseUri = tmpResolver.ResolveUri(null, _url); 3145_ps.baseUriStr = _ps.baseUri.ToString(); 3148if (_ps.stream == null) 3150ThrowWithoutLineInfo(ResXml.Xml_CannotResolveUrl, _ps.baseUriStr); 3153InitStreamInput(_ps.baseUri, _ps.baseUriStr, _ps.stream, null); 3154_reportedEncoding = _ps.encoding; 3160_ps.stream = (Stream)GetTempResolver().GetEntity(_ps.baseUri, null, typeof(Stream)); 3166Debug.Assert(_ps.bytes != null); 3167Debug.Assert(_ps.bytePos == 0); 3169if (_ps.bytesUsed < 2) 3173int first2Bytes = _ps.bytes[0] << 8 | _ps.bytes[1]; 3174int next2Bytes = (_ps.bytesUsed >= 4) ? (_ps.bytes[2] << 8 | _ps.bytes[3]) : 0; 3251Debug.Assert(_ps.charPos == 0); 3252_ps.encoding = Encoding.UTF8; 3253_ps.decoder = new SafeAsciiDecoder(); 3257_ps.encoding = encoding; 3259switch (_ps.encoding.WebName) 3262_ps.decoder = new UTF16Decoder(false); 3265_ps.decoder = new UTF16Decoder(true); 3268_ps.decoder = encoding.GetDecoder(); 3277if ((newEncoding.WebName != _ps.encoding.WebName || _ps.decoder is SafeAsciiDecoder) && !_afterResetState) 3279Debug.Assert(_ps.stream != null); 3281_ps.appendMode = false; 3292if (_ps.stream == null) 3294return _ps.encoding; 3302if (_ps.encoding.WebName != "utf-16BE" && 3303_ps.encoding.WebName != "utf-16" && 3315return _ps.encoding; 3341if (_afterResetState && _ps.encoding.WebName != newEncoding.WebName) 3351Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3352Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false"); 3354Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range."); 3362Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos, 3364_charactersInDocument -= _ps.charsUsed - _ps.charPos; 3370Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos, 3372_charactersFromEntities -= _ps.charsUsed - _ps.charPos; 3376_ps.bytePos = _documentStartBytePos; // byte position after preamble 3377if (_ps.charPos > 0) 3379_ps.bytePos += _ps.encoding.GetByteCount(_ps.chars, 0, _ps.charPos); 3381_ps.charsUsed = _ps.charPos; 3382_ps.isEof = false; 3398if (_ps.isEof) 3404if (_ps.appendMode) 3407if (_ps.charsUsed == _ps.chars.Length - 1) 3415char[] newChars = new char[_ps.chars.Length * 2]; 3416BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3417_ps.chars = newChars; 3420if (_ps.stream != null) 3423if (_ps.bytesUsed - _ps.bytePos < MaxByteSequenceLen) 3425if (_ps.bytes.Length - _ps.bytesUsed < MaxByteSequenceLen) 3427byte[] newBytes = new byte[_ps.bytes.Length * 2]; 3428BlockCopy(_ps.bytes, 0, newBytes, 0, _ps.bytesUsed); 3429_ps.bytes = newBytes; 3434charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3442int charsLen = _ps.chars.Length; 3443if (charsLen - _ps.charsUsed <= charsLen / 2) 3452int copyCharsCount = _ps.charsUsed - _ps.charPos; 3455_ps.lineStartPos = _ps.lineStartPos - _ps.charPos; 3458BlockCopyChars(_ps.chars, _ps.charPos, _ps.chars, 0, copyCharsCount); 3460_ps.charPos = 0; 3461_ps.charsUsed = copyCharsCount; 3465char[] newChars = new char[_ps.chars.Length * 2]; 3466BlockCopyChars(_ps.chars, 0, newChars, 0, _ps.chars.Length); 3467_ps.chars = newChars; 3471if (_ps.stream != null) 3474int bytesLeft = _ps.bytesUsed - _ps.bytePos; 3479_ps.bytesUsed = 0; 3483BlockCopy(_ps.bytes, _ps.bytePos, _ps.bytes, 0, bytesLeft); 3484_ps.bytesUsed = bytesLeft; 3486_ps.bytePos = 0; 3489charsRead = _ps.chars.Length - _ps.charsUsed - 1; 3492if (_ps.stream != null) 3494if (!_ps.isStreamEof) 3497if (_ps.bytePos == _ps.bytesUsed && _ps.bytes.Length - _ps.bytesUsed > 0) 3499int read = _ps.stream.Read(_ps.bytes, _ps.bytesUsed, _ps.bytes.Length - _ps.bytesUsed); 3502_ps.isStreamEof = true; 3504_ps.bytesUsed += read; 3508int originalBytePos = _ps.bytePos; 3512if (charsRead == 0 && _ps.bytePos != originalBytePos) 3518else if (_ps.textReader != null) 3521charsRead = _ps.textReader.Read(_ps.chars, _ps.charsUsed, _ps.chars.Length - _ps.charsUsed - 1); 3522_ps.charsUsed += charsRead; 3533Debug.Assert(_ps.charsUsed < _ps.chars.Length); 3534_ps.isEof = true; 3536_ps.chars[_ps.charsUsed] = (char)0; 3543Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3544Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1); 3547int bytesCount = _ps.bytesUsed - _ps.bytePos; 3558_ps.decoder.Convert(_ps.bytes, _ps.bytePos, bytesCount, _ps.chars, _ps.charsUsed, maxCharsCount, false, out bytesCount, out charsCount, out completed); 3566_ps.bytePos += bytesCount; 3567_ps.charsUsed += charsCount; 3583_ps.decoder.Convert(_ps.bytes, _ps.bytePos + bytesDecoded, 1, _ps.chars, _ps.charsUsed + charsDecoded, 1, false, out bDec, out chDec, out completed); 3595Throw(_ps.charsUsed, ResXml.Xml_InvalidCharInThisEncoding); 3613_ps.Close(closeInput); 3628BlockCopyChars(_ps.chars, sourcePos, _ps.chars, destPos, count); 3634while (_ps.charsUsed - _ps.charPos < 6) 3642if (!XmlConvert.StrEqual(_ps.chars, _ps.charPos, 5, XmlDeclarationBegining) || 3643_xmlCharType.IsNameSingleChar(_ps.chars[_ps.charPos + 5]) 3654_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos + 2); 3657_ps.charPos += 5; 3673if (_ps.chars[_ps.charPos] == '?') 3677if (_ps.chars[_ps.charPos + 1] == '>') 3684_ps.charPos += 2; 3704string encodingName = _ps.encoding.WebName; 3706encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3708Throw(ResXml.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3711if (_ps.decoder is SafeAsciiDecoder) 3720_ps.appendMode = false; 3723else if (_ps.charPos + 1 == _ps.charsUsed) 3742switch (_ps.chars[_ps.charPos]) 3745if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos, "version") && xmlDeclState == 0) 3755if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos, "encoding") && 3767if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos, "standalone") && 3784attr.SetLineInfo(_ps.LineNo, _ps.LinePos); 3786sb.Append(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 3787_ps.charPos = nameEndPos; 3790if (_ps.chars[_ps.charPos] != '=') 3793if (_ps.chars[_ps.charPos] != '=') 3799_ps.charPos++; 3801char quoteChar = _ps.chars[_ps.charPos]; 3805quoteChar = _ps.chars[_ps.charPos]; 3812_ps.charPos++; 3816attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 3820int pos = _ps.charPos; 3823chars = _ps.chars; 3832if (_ps.chars[pos] == quoteChar) 3846if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, pos - _ps.charPos, "1.0")) 3851attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3857string badVersion = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3862string encName = new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 3871if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, pos - _ps.charPos, "yes")) 3875else if (XmlConvert.StrEqual(_ps.chars, _ps.charPos, pos - _ps.charPos, "no")) 3882Throw(ResXml.Xml_InvalidXmlDecl, _ps.LineNo, _ps.LinePos - 1); 3886attr.SetValue(_ps.chars, _ps.charPos, pos - _ps.charPos); 3894sb.Append(chars, _ps.charPos, pos - _ps.charPos); 3896_ps.charPos = pos + 1; 3899else if (pos == _ps.charsUsed) 3916if (_ps.isEof || ReadData() == 0) 3931string encodingName = _ps.encoding.WebName; 3933encodingName != "utf-16BE" && !(_ps.encoding is Ucs4Encoding)) 3935Throw(ResXml.Xml_EncodingSwitchAfterResetState, (_ps.encoding.GetByteCount("A") == 1) ? "UTF-8" : "UTF-16"); 3938if (_ps.decoder is SafeAsciiDecoder) 3942_ps.appendMode = false; 3962int pos = _ps.charPos; 3963char[] chars = _ps.chars; 3969if (_ps.charsUsed - pos < 4) // minimum "<a/>" 3976_ps.charPos = pos + 1; 3984if (_ps.charsUsed - pos < 2) // minimum characters expected "--" 3991_ps.charPos = pos + 2; 4009if (_ps.charsUsed - pos < 6) 4015_ps.charPos = pos + 6; 4030Throw(_ps.charPos, ResXml.Xml_InvalidRootData); 4039_ps.charPos = pos; 4075_ps.charPos = pos; 4112chars = _ps.chars; 4113pos = _ps.charPos; 4119else if (pos == _ps.charsUsed || ((_v1Compat || mangoQuirks) && chars[pos] == 0x0)) 4147Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 4153pos = _ps.charPos; 4186pos = _ps.charPos; 4187chars = _ps.chars; 4196int pos = _ps.charPos; 4197char[] chars = _ps.chars; 4207_ps.charPos = pos + 2; 4215if (_ps.charsUsed - pos < 2) 4222_ps.charPos = pos + 2; 4238if (_ps.charsUsed - pos < 6) 4244_ps.charPos = pos + 6; 4267_ps.charPos = pos + 2; 4272if (pos + 1 == _ps.charsUsed) 4279_ps.charPos = pos + 1; 4293if (pos == _ps.charsUsed) 4312if (_ps.charsUsed - _ps.charPos != 0) 4338Throw(_ps.charsUsed, ResXml.Xml_UnexpectedEOF1); 4361Throw(_ps.charsUsed, ResXml.Xml_UnexpectedEOFInElementContent, _stringBuilder.ToString()); 4368int pos = _ps.charPos; 4369char[] chars = _ps.chars; 4372_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 4439else if (pos + 1 < _ps.charsUsed) 4446chars = _ps.chars; 4456_nameTable.Add(chars, _ps.charPos, pos - _ps.charPos)); 4460int startPos = _ps.charPos; 4473_nameTable.Add(chars, _ps.charPos, prefixLen), 4488_ps.charPos = pos; 4498_ps.charPos = pos + 1; 4504if (pos + 1 == _ps.charsUsed) 4506_ps.charPos = pos; 4511pos = _ps.charPos; 4512chars = _ps.chars; 4519_ps.charPos = pos + 2; 4529Throw(pos, ResXml.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4628while (_ps.charsUsed - _ps.charPos < prefLen + locLen + 1) 4637char[] chars = _ps.chars; 4640if (!XmlConvert.StrEqual(chars, _ps.charPos, locLen, startTagNode.localName)) 4648int colonPos = _ps.charPos + prefLen; 4649if (!XmlConvert.StrEqual(chars, _ps.charPos, prefLen, startTagNode.prefix) || 4658LineInfo endTagLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 4663pos = _ps.charPos + nameLen; 4664chars = _ps.chars; 4666if (pos == _ps.charsUsed) 4701else if (pos == _ps.charsUsed && !_ps.isEof) 4715else if (pos == _ps.charsUsed) 4741_ps.charPos = pos + 1; 4760args[3] = new string(_ps.chars, _ps.charPos, endPos - _ps.charPos); 4773int pos = _ps.charPos; 4774char[] chars = _ps.chars; 4801else if (pos + 1 != _ps.charsUsed) 4808_ps.charPos = pos; 4838_ps.charPos = pos + 1; 4846if (pos + 1 == _ps.charsUsed) 4852_ps.charPos = pos + 2; 4863else if (pos == _ps.charsUsed) 4869Throw(pos, ResXml.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 4873if (pos == _ps.charPos) 4877_ps.charPos = pos; 4880int attrNameLinePos = _ps.LinePos; 4883int attrNameLineNo = _ps.LineNo; 4953chars = _ps.chars; 4956else if (pos + 1 >= _ps.charsUsed) 4959chars = _ps.chars; 4963attr.SetLineInfo(_ps.LineNo, attrNameLinePos); 4966Debug.Assert(attrNameLineNo == _ps.LineNo); 4972_ps.charPos = pos; 4974pos = _ps.charPos; 4985_ps.charPos = pos; 4987pos = _ps.charPos; 4995_ps.charPos = pos; 4998attr.SetLineInfo2(_ps.LineNo, _ps.LinePos); 5014string val = new string(chars, _ps.charPos, pos - _ps.charPos); 5018attr.SetValue(chars, _ps.charPos, pos - _ps.charPos); 5020_ps.charPos = pos; 5025pos = _ps.charPos; 5026chars = _ps.chars; 5054_ps.lineNo -= lineNoDelta; 5057pos = _ps.charPos; 5058chars = _ps.chars; 5221char[] chars = _ps.chars; 5222int attributeBaseEntityId = _ps.entityId; 5224LineInfo valueChunkLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos); 5240if (pos - _ps.charPos > 0) 5242_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5243_ps.charPos = pos; 5246if (chars[pos] == quoteChar && attributeBaseEntityId == _ps.entityId) 5261_ps.charPos++; 5270_stringBuilder.Append(_ps.eolNormalized ? "\u0020\u0020" : "\u0020"); // CDATA normalization of 0xD 0xA 5271_ps.charPos = pos; 5274else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5280_ps.charPos = pos; 5295_ps.charPos++; 5309if (pos - _ps.charPos > 0) 5311_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 5313_ps.charPos = pos; 5315int enclosingEntityId = _ps.entityId; 5316LineInfo entityLineInfo = new LineInfo(_ps.lineNo, _ps.LinePos + 1); 5324if (_parsingMode == ParsingMode.Full && _ps.entityId == attributeBaseEntityId) 5338_ps.charPos++; 5355valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5361_ps.charPos++; 5364pos = _ps.charPos; 5385entityChunk.SetNamedNode(XmlNodeType.EntityReference, _ps.entity.Name); 5393pos = _ps.charPos; 5396pos = _ps.charPos; 5399chars = _ps.chars; 5403if (pos == _ps.charsUsed) 5413if (pos + 1 == _ps.charsUsed) 5424ThrowInvalidChar(chars, _ps.charsUsed, pos); 5434if (_ps.charsUsed - _ps.charPos > 0) 5436if (_ps.chars[_ps.charPos] != (char)0xD) 5441Debug.Assert(_ps.isEof); 5449if (attributeBaseEntityId != _ps.entityId) 5463if (attributeBaseEntityId == _ps.entityId) 5466valueChunkLineInfo.Set(_ps.LineNo, _ps.LinePos); 5471pos = _ps.charPos; 5472chars = _ps.chars; 5489_ps.charPos = pos + 1; 5527_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 5543_curNode.SetValueNode(nodeType, _ps.chars, startPos, endPos - startPos); 5556_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5562_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5587_curNode.SetValueNode(XmlNodeType.Text, _ps.chars, startPos, endPos - startPos); 5596_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5603_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5660char[] chars = _ps.chars; 5661int pos = _ps.charPos; 5692if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 5694if (pos - _ps.charPos > 0) 5710_ps.charPos++; 5715else if (pos + 1 < _ps.charsUsed || _ps.isEof) 5717if (!_ps.eolNormalized) 5755if (pos > _ps.charPos) 5776if (!_xmlCharType.IsWhiteSpace(_ps.chars[pos - 1])) 5782pos = _ps.charPos; 5785chars = _ps.chars; 5789if (_ps.charsUsed - pos < 3 && !_ps.isEof) 5802if (pos == _ps.charsUsed) 5812if (pos + 1 == _ps.charsUsed) 5824int offset = pos - _ps.charPos; 5827chars = _ps.chars; 5828pos = _ps.charPos + offset; 5833ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos + offset); 5840if (pos > _ps.charPos) 5847if (_ps.charsUsed - _ps.charPos > 0) 5849if (_ps.chars[_ps.charPos] != (char)0xD && _ps.chars[_ps.charPos] != ']') 5853Debug.Assert(_ps.isEof); 5872pos = _ps.charPos; 5873chars = _ps.chars; 5885startPos = _ps.charPos; 5887_ps.charPos = pos; 5906_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 5908_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6033if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 6040_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6042if (_ps.chars[_ps.charPos] == '<' || _ps.charsUsed - _ps.charPos == 0 || ZeroEndingStream(_ps.charPos)) 6054if (_xmlCharType.IsCharData(_ps.chars[_ps.charPos])) 6060ThrowInvalidChar(_ps.chars, _ps.charsUsed, _ps.charPos); 6067Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6068_ps.charPos++; 6070_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6076Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6078if (_ps.charPos + 1 == _ps.charsUsed) 6087if (_ps.chars[_ps.charPos + 1] == '#') 6115_ps.charPos++; 6116int savedLinePos = _ps.LinePos; 6123Throw(ResXml.Xml_ErrorParsingEntityName, _ps.LineNo, savedLinePos); 6128if (_ps.chars[endPos] != ';') 6133int entityLinePos = _ps.LinePos; 6134string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 6135_ps.charPos = endPos + 1; 6139_reportedBaseUri = _ps.baseUriStr; 6140_reportedEncoding = _ps.encoding; 6166Throw(ResXml.Xml_UndeclaredEntity, name, _ps.LineNo, entityStartLinePos); 6178Throw(ResXml.Xml_UnparsedEntityRef, name, _ps.LineNo, entityStartLinePos); 6183Throw(ResXml.Xml_ExternalEntityInStandAloneDocument, entity.Name, _ps.LineNo, entityStartLinePos); 6190Throw(ResXml.Xml_ExternalEntityInAttValue, name, _ps.LineNo, entityStartLinePos); 6204_curNode.entityId = _ps.entityId; 6212_curNode.entityId = _ps.entityId; 6225_curNode.entityId = _ps.entityId; 6247if (_ps.entityResolvedManually) 6253if (_ps.entityId != _nodes[_index].entityId) 6259_lastEntity = _ps.entity; // save last entity for the EndEntity node 6268if (_ps.entityId != _nodes[_index].entityId) 6276_reportedEncoding = _ps.encoding; 6277_reportedBaseUri = _ps.baseUriStr; 6286_reportedEncoding = _ps.encoding; 6287_reportedBaseUri = _ps.baseUriStr; 6292_curNode.lineInfo.Set(_ps.lineNo, _ps.LinePos - 1); 6320_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6327string target = _nameTable.Add(_ps.chars, _ps.charPos, nameEndPos - _ps.charPos); 6333_ps.charPos = nameEndPos; 6348char ch = _ps.chars[_ps.charPos]; 6349Debug.Assert(_ps.charPos < _ps.charsUsed); 6352if (_ps.charsUsed - _ps.charPos < 2) 6356if (ch != '?' || _ps.chars[_ps.charPos + 1] != '>') 6358Throw(ResXml.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(_ps.chars, _ps.charsUsed, _ps.charPos)); 6374_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 6379piInDtdStringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6402sb.Append(_ps.chars, startPos, endPos - startPos); 6404sb.Append(_ps.chars, startPos, endPos - startPos); 6418if (_ps.charsUsed - _ps.charPos < 2) 6422Throw(_ps.charsUsed, ResXml.Xml_UnexpectedEOF, "PI"); 6426int pos = _ps.charPos; 6427char[] chars = _ps.chars; 6451Debug.Assert(!_ps.eolNormalized); 6459outStartPos = _ps.charPos; 6460_ps.charPos = pos + 2; 6463else if (pos + 1 == _ps.charsUsed) 6480if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6483if (pos - _ps.charPos > 0) 6499_ps.charPos++; 6504else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6506if (!_ps.eolNormalized) 6526if (pos == _ps.charsUsed) 6536if (pos + 1 == _ps.charsUsed) 6547ThrowInvalidChar(chars, _ps.charsUsed, pos); 6563outStartPos = _ps.charPos; 6564_ps.charPos = pos; 6597_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6601_curNode.SetValueNode(type, _ps.chars, startPos, endPos - startPos); 6607_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6609_stringBuilder.Append(_ps.chars, startPos, endPos - startPos); 6623if (_ps.charsUsed - _ps.charPos < 3) 6632int pos = _ps.charPos; 6633char[] chars = _ps.chars; 6659Debug.Assert(!_ps.eolNormalized); 6667outStartPos = _ps.charPos; 6668_ps.charPos = pos + 3; 6671else if (pos + 2 == _ps.charsUsed) 6680else if (pos + 1 == _ps.charsUsed) 6700if (!_ps.eolNormalized && _parsingMode == ParsingMode.Full) 6702if (pos - _ps.charPos > 0) 6718_ps.charPos++; 6723else if (pos + 1 < _ps.charsUsed || _ps.isEof) 6725if (!_ps.eolNormalized) 6745if (pos == _ps.charsUsed) 6753if (pos + 1 == _ps.charsUsed) 6764ThrowInvalidChar(chars, _ps.charsUsed, pos); 6779outStartPos = _ps.charPos; 6781_ps.charPos = pos; 6795while (_ps.charsUsed - _ps.charPos < 8) 6802if (!XmlConvert.StrEqual(_ps.chars, _ps.charPos, 7, "DOCTYPE")) 6806if (!_xmlCharType.IsWhiteSpace(_ps.chars[_ps.charPos + 7])) 6808ThrowExpectingWhitespace(_ps.charPos + 7); 6813Throw(_ps.charPos - 2, ResXml.Xml_MultipleDTDsProvided); // position just before <!DOCTYPE 6817Throw(_ps.charPos - 2, ResXml.Xml_DtdAfterRootElement); 6820_ps.charPos += 8; 6827_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 6866_ps.charPos = pos; 6872if (_ps.chars[_ps.charPos] == 'P') 6875while (_ps.charsUsed - _ps.charPos < 6) 6883if (!XmlConvert.StrEqual(_ps.chars, _ps.charPos, 6, "PUBLIC")) 6887_ps.charPos += 6; 6892ThrowExpectingWhitespace(_ps.charPos); 6901ThrowExpectingWhitespace(_ps.charPos); 6909else if (_ps.chars[_ps.charPos] == 'S') 6912while (_ps.charsUsed - _ps.charPos < 6) 6920if (!XmlConvert.StrEqual(_ps.chars, _ps.charPos, 6, "SYSTEM")) 6924_ps.charPos += 6; 6929ThrowExpectingWhitespace(_ps.charPos); 6937else if (_ps.chars[_ps.charPos] != '[' && _ps.chars[_ps.charPos] != '>') 6943if (_ps.chars[_ps.charPos] == '[') 6945_ps.charPos++; 6950if (_ps.chars[_ps.charPos] != '>') 6955else if (_ps.chars[_ps.charPos] == '>') 6963_ps.charPos++; 6969char quoteChar = _ps.chars[_ps.charPos]; 6975_ps.charPos++; 6986char[] chars = _ps.chars; 6987int pos = _ps.charPos; 7004_ps.charPos = pos + 1; 7009_ps.charPos = pos; 7022else if (pos + 1 < _ps.charsUsed || _ps.isEof) 7048if (pos + 3 >= _ps.charsUsed && !_ps.isEof) 7063else if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 7073if (pos + 2 >= _ps.charsUsed && !_ps.isEof) 7091if (pos + 1 >= _ps.charsUsed && !_ps.isEof) 7132if (pos == _ps.charsUsed) 7142if (pos + 1 == _ps.charsUsed) 7153ThrowInvalidChar(chars, _ps.charsUsed, pos); 7162if (_ps.charsUsed - _ps.charPos > 0) 7164if (_ps.chars[_ps.charPos] != (char)0xD) 7169Debug.Assert(_ps.isEof); 7176chars = _ps.chars; 7177pos = _ps.charPos; 7183int pos = _ps.charPos; 7185char[] chars = _ps.chars; 7200int tmp1 = pos - _ps.charPos; 7201if (sb != null && !_ps.eolNormalized) 7205sb.Append(chars, _ps.charPos, tmp1); 7208_ps.charPos = pos + 1; 7212else if (pos + 1 < _ps.charsUsed || _ps.isEof) 7214if (!_ps.eolNormalized) 7231if (pos == _ps.charsUsed) 7237int tmp2 = pos - _ps.charPos; 7242sb.Append(_ps.chars, _ps.charPos, tmp2); 7244_ps.charPos = pos; 7253int tmp3 = pos - _ps.charPos; 7258sb.Append(_ps.chars, _ps.charPos, tmp3); 7260_ps.charPos = pos; 7266if (_ps.charsUsed - _ps.charPos == 0) 7270if (_ps.chars[_ps.charPos] != (char)0xD) 7275Debug.Assert(_ps.isEof); 7277pos = _ps.charPos; 7278chars = _ps.chars; 7284Debug.Assert(_ps.chars[startPos] == '&'); 7285if (_ps.chars[startPos + 1] == '#') 7308switch (newPos = ParseNumericCharRefInline(_ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType)) 7316Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7321_ps.charPos = newPos - charCount; 7336Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#'); 7344chars = _ps.chars; 7371else if (pos < _ps.charsUsed) 7391_ps.charPos = pos; 7398if (pos == _ps.charsUsed) 7416Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, ResXml.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(ch, '\0')); 7423internalSubsetBuilder.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7445Throw((_ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, ResXml.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(high, low)); 7454internalSubsetBuilder.Append(_ps.chars, _ps.charPos, pos - _ps.charPos + 1); 7475switch (newPos = ParseNamedCharRefInline(_ps.charPos, expand, internalSubsetBuilder)) 7485Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7490_ps.charPos = newPos - 1; 7505Debug.Assert(startPos < _ps.charsUsed); 7506Debug.Assert(_ps.chars[startPos] == '&'); 7507Debug.Assert(_ps.chars[startPos + 1] != '#'); 7510char[] chars = _ps.chars; 7521if (_ps.charsUsed - pos >= 3) 7538if (_ps.charsUsed - pos >= 4) 7553else if (pos < _ps.charsUsed) 7560if (_ps.charsUsed - pos >= 5) 7577if (_ps.charsUsed - pos >= 3) 7593if (_ps.charsUsed - pos >= 3) 7620internalSubsetBuilder.Append(_ps.chars, _ps.charPos, pos - _ps.charPos); 7622_ps.chars[pos - 1] = ch; 7641int pos = _ps.charPos + startOffset; 7644char[] chars = _ps.chars; 7660if (pos + 1 >= _ps.charsUsed) 7670Throw(pos, ResXml.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos)); 7706colonOffset = pos - _ps.charPos; 7712colonOffset = pos - _ps.charPos; 7718else if (pos == _ps.charsUsed 7726chars = _ps.chars; 7733colonPos = (colonOffset == -1) ? -1 : _ps.charPos + colonOffset; 7739int offset = pos - _ps.charPos; 7741pos = _ps.charPos + offset; 7759if (_ps.chars[endPos] != ';') 7764string entityName = _nameTable.Add(_ps.chars, _ps.charPos, endPos - _ps.charPos); 7765_ps.charPos = endPos + 1; 7817string localName = _nameTable.Add(_ps.chars, _ps.charPos, endNamePos - _ps.charPos); 7823int startPos = _ps.charPos; 7825if (prefixLen == _lastPrefix.Length && XmlConvert.StrEqual(_ps.chars, startPos, prefixLen, _lastPrefix)) 7827return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7833string prefix = _nameTable.Add(_ps.chars, startPos, prefixLen); 7835return AddAttribute(_nameTable.Add(_ps.chars, colonPos + 1, endNamePos - colonPos - 1), 7893_ps.lineNo++; 7894_ps.lineStartPos = pos - 1; 7899Debug.Assert(_ps.isEof); 7902_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8144Debug.Assert(_ps.appendMode); 8145int initialPos = _ps.charPos; 8152_ps.charPos = initialPos; 8158Encoding enc = _ps.encoding; 8175Encoding enc = _ps.encoding; 8183_ps.lineNo = entity.LineNumber; 8184_ps.lineStartPos = -entity.LinePosition - 1; 8186_ps.eolNormalized = true; 8193if (_ps.stream != null) 8195_ps.stream.Close(); 8199_curNode.entityId = _ps.entityId; 8215_ps.entity = entity; 8216_ps.entityId = _nextEntityId++; 8232if (_ps.entity != null) 8234_currentEntities.Remove(_ps.entity); 8252_parsingStatesStack[_parsingStatesStackTop] = _ps; 8254_ps.Clear(); 8260_ps.Close(true); 8272_incReadLeftStartPos = _ps.charPos; 8273_incReadLeftEndPos = _ps.charPos; 8274_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8321count = _incReadDecoder.Decode(_ps.chars, _incReadLeftStartPos, charsLeft); 8360Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 2, 2, "?>")); 8361_ps.charPos -= 2; 8368Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "-->")); 8369_ps.charPos -= 3; 8376Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "]]>")); 8377_ps.charPos -= 3; 8396startPos = _ps.charPos; 8407char[] chars = _ps.chars; 8408startPos = _ps.charPos; 8413_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 8457else if (pos + 1 < _ps.charsUsed) 8474if (_ps.charsUsed - pos < 2) 8487if (_ps.charsUsed - pos < 4) 8497if (_ps.charsUsed - pos < 9) 8515Debug.Assert(_ps.charPos - pos == 0); 8516Debug.Assert(_ps.charPos - startPos == 0); 8521if (XmlConvert.StrEqual(chars, _ps.charPos + 2, endPos - _ps.charPos - 2, _curNode.GetNameWPrefix(_nameTable)) && 8522(_ps.chars[endPos] == '>' || _xmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8530_ps.charPos = endPos; 8531if (_xmlCharType.IsWhiteSpace(_ps.chars[endPos])) 8535if (_ps.chars[_ps.charPos] != '>') 8539_ps.charPos++; 8547startPos = _ps.charPos; 8548chars = _ps.chars; 8555Debug.Assert(_ps.charPos - pos == 0); 8556Debug.Assert(_ps.charPos - startPos == 0); 8561if (XmlConvert.StrEqual(_ps.chars, _ps.charPos + 1, endPos - _ps.charPos - 1, _curNode.localName) && 8562(_ps.chars[endPos] == '>' || _ps.chars[endPos] == '/' || _xmlCharType.IsWhiteSpace(_ps.chars[endPos]))) 8570startPos = _ps.charPos; 8571chars = _ps.chars; 8580if (_ps.charsUsed - pos < 2) 8619if (pos == _ps.charsUsed) 8636_ps.charPos = pos; 8646count = _incReadDecoder.Decode(_ps.chars, startPos, charsParsed); 8683ParseAttributeValueSlow(_ps.charPos, ' ', _curNode); // The quote char is intentionally empty (space) because we need to parse ' and " into the attribute value 8707char[] chars = _ps.chars; 8708int pos = _ps.charPos; 8711_curNode.SetLineInfo(_ps.LineNo, _ps.LinePos); 8734Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!"); 8757if (pos - _ps.charPos > 0) 8759_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8761_ps.charPos = pos; 8769chars = _ps.chars; 8770if (_normalize && _xmlCharType.IsWhiteSpace(chars[_ps.charPos]) && pos - _ps.charPos == 1) 8772chars[_ps.charPos] = (char)0x20; // CDATA normalization of character references in entities 8779_ps.charPos++; 8791chars = _ps.chars; 8795if (pos == _ps.charsUsed) 8805if (pos + 1 == _ps.charsUsed) 8816ThrowInvalidChar(chars, _ps.charsUsed, pos); 8822if (pos - _ps.charPos > 0) 8824_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8825_ps.charPos = pos; 8848pos = _ps.charPos; 8849chars = _ps.chars; 8853if (pos - _ps.charPos > 0) 8855_stringBuilder.Append(chars, _ps.charPos, pos - _ps.charPos); 8856_ps.charPos = pos; 8887_ps.charPos = pos; 8910_ps.charPos = pos; 8916if (_ps.charPos == _ps.charsUsed) 8920if (_xmlCharType.IsNCNameSingleChar(_ps.chars[_ps.charPos])) 8922int pos = _ps.charPos + 1; 8923while (_xmlCharType.IsNCNameSingleChar(_ps.chars[pos])) 8927return new string(_ps.chars, _ps.charPos, pos - _ps.charPos); 8931Debug.Assert(_ps.charPos < _ps.charsUsed); 8932return new string(_ps.chars, _ps.charPos, 1); 8990if (_v1Compat && pos == _ps.charsUsed - 1 && _ps.chars[pos] == (char)0 && ReadData() == 0 && _ps.isStreamEof) 8992_ps.charsUsed--; 9498_curNode.AdjustLineInfo(_readValueOffset, _ps.eolNormalized, ref _incReadLineInfo); 9522_incReadLineInfo.Set(_ps.LineNo, _ps.LinePos); 9527charsRead = _incReadDecoder.Decode(_ps.chars, startPos, endPos - startPos); 9541_curNode.SetValue(_ps.chars, startPos, endPos - startPos); 9543AdjustLineInfo(_ps.chars, startPos - charsRead, startPos, _ps.eolNormalized, ref _incReadLineInfo);