1 write to ps
System.Xml (1)
System\Xml\Core\XmlTextReaderImpl.cs (1)
7301ps = parsingStatesStack[ parsingStatesStackTop-- ];
1682 references to ps
System.Xml (1682)
System\Xml\Core\XmlTextReaderImpl.cs (1011)
390ps.lineNo = 1; 391ps.lineStartPos = -1; 453ps.lineNo = lineNumberOffset + 1; 454ps.lineStartPos = - linePositionOffset - 1; 455curNode.SetLineInfo( ps.LineNo - 1, ps.LinePos - 1 ); 507reportedBaseUri = ps.baseUriStr; 508reportedEncoding = ps.encoding; 523reportedEncoding = ps.encoding; 547reportedBaseUri = ps.baseUriStr; 548reportedEncoding = ps.encoding; 569reportedEncoding = ps.encoding; 611ps.baseUri = GetTempResolver().ResolveUri(null, url); 612ps.baseUriStr = ps.baseUri.ToString(); 613reportedBaseUri = ps.baseUriStr; 693reportedEncoding = ps.encoding; 761reportedEncoding = ps.encoding; 807reportedEncoding = ps.encoding; 825reportedBaseUri = ps.baseUriStr; 826reportedEncoding = ps.encoding; 1174Debug.Assert( !ps.appendMode ); 1182reportedEncoding = ps.encoding; 1185reportedEncoding = ps.encoding; 1223reportedEncoding = ps.encoding; 1224reportedBaseUri = ps.baseUriStr; 1230curNode.SetLineInfo( ps.lineNo, ps.LinePos ); 1231reportedEncoding = ps.encoding; 1232reportedBaseUri = ps.baseUriStr; 1401attributeValueBaseEntityId = ps.entityId; 1409if ( ps.entityId == attributeValueBaseEntityId ) { 1442if ( ps.charsUsed - ps.charPos == 0 ) { // entity value == "" 1460if ( ps.charsUsed - ps.charPos == 0 && !ps.entity.IsExternal ) { // empty internal entity value 1476ps.entityResolvedManually = true; 1787BlockCopyChars( ps.chars, startPos, buffer, ( index + readCount ), copyCount ); 1807curNode.SetValue( ps.chars, startPos, endPos - startPos ); 1906if ( ps.entity == null || ps.entity.IsExternal ) { 1907ps.eolNormalized = !value; 1979ps.baseUri = null; 2037stringBuilder.Append( ps.chars, incReadLeftStartPos, incReadLeftEndPos - incReadLeftStartPos ); 2046ps.appendMode = false; 2048stringBuilder.Append( ps.chars, ps.charPos, ps.charsUsed - ps.charPos ); 2049ps.charPos = ps.charsUsed; 2205if ( ps.baseUriStr.Length > 0 && ps.baseUri == null && xmlResolver != null ) { 2206ps.baseUri = xmlResolver.ResolveUri( null, ps.baseUriStr ); 2208return ps.baseUri; 2214return ps.isEof; 2220return ps.chars; 2226return ps.charsUsed; 2232return ps.charPos; 2235Debug.Assert( value >= 0 && value <= ps.charsUsed ); 2236ps.charPos = value; 2248return ps.eolNormalized; 2269return ps.LineNo; 2275return ps.lineStartPos; 2326if ( e.ResString == Res.Xml_UnexpectedEOF && ps.entity != null ) { 2327SendValidationEvent( XmlSeverityType.Error, Res.Sch_ParEntityRefNesting, null, ps.LineNo, ps.LinePos ); 2368entityId = ps.entityId; 2378oldEntity = ps.entity; 2380newEntityId = ps.entityId; 2397if (ps.baseUri == null && !string.IsNullOrEmpty(ps.baseUriStr)) { 2398ps.baseUri = xmlResolver.ResolveUri(null, ps.baseUriStr); 2400PushExternalEntityOrSubset( publicId, systemId, ps.baseUri, null ); 2402ps.entity = null; 2403ps.entityId = 0; 2405Debug.Assert( ps.appendMode ); 2406int initialPos = ps.charPos; 2411ps.charPos = initialPos; 2426ps.entity = null; 2427ps.entityId = 0; 2428ps.eolNormalized = false; 2453ps.charPos = pos; 2458ps.charPos = pos; 2463ps.charPos = pos; 2472Throw( new XmlException( res, string.Empty, lineNo, linePos, ps.baseUriStr ) ); 2476Throw( new XmlException( res, arg, ps.LineNo, ps.LinePos, ps.baseUriStr ) ); 2480Throw( new XmlException( res, arg, lineNo, linePos, ps.baseUriStr ) ); 2484Throw( new XmlException( res, args, ps.LineNo, ps.LinePos, ps.baseUriStr ) ); 2492Throw( new XmlException( res, args, innerException, ps.LineNo, ps.LinePos, ps.baseUriStr ) ); 2505Throw( new XmlException( e.Message, (Exception)null, lineNo, linePos, ps.baseUriStr ) ); 2509Throw( new XmlException( res, string.Empty, ps.baseUriStr ) ); 2513Throw( new XmlException( res, arg, ps.baseUriStr ) ); 2517Throw( new XmlException( res, args, innerException, 0, 0, ps.baseUriStr ) ); 2531SendValidationEvent( severity, new XmlSchemaException( code, arg, ps.baseUriStr, lineNo, linePos ) ); 2562while ( ps.entityId != attributeValueBaseEntityId ) { 2602Debug.Assert( ps.charPos == 0 && ps.charsUsed == 0 && ps.textReader == null ); 2606ps.stream = stream; 2607ps.baseUri = baseUri; 2608ps.baseUriStr = baseUriStr; 2613ps.bytes = bytes; 2614ps.bytesUsed = byteCount; 2615bufferSize = ps.bytes.Length; 2629if ( ps.bytes == null || ps.bytes.Length < bufferSize ) { 2630ps.bytes = new byte[ bufferSize ]; 2635if ( ps.chars == null || ps.chars.Length < bufferSize + 1 ) { 2636ps.chars = new char[ bufferSize + 1 ]; 2640ps.bytePos = 0; 2641while ( ps.bytesUsed < 4 && ps.bytes.Length - ps.bytesUsed > 0 ) { 2642int read = stream.Read( ps.bytes, ps.bytesUsed, ps.bytes.Length - ps.bytesUsed ); 2644ps.isStreamEof = true; 2647ps.bytesUsed += read; 2657byte[] preamble = ps.encoding.GetPreamble(); 2660for ( i = 0; i < preambleLen && i < ps.bytesUsed; i++ ) { 2661if ( ps.bytes[i] != preamble[i] ) { 2666ps.bytePos = preambleLen; 2669documentStartBytePos = ps.bytePos; 2671ps.eolNormalized = !normalize; 2674ps.appendMode = true; 2683Debug.Assert( ps.charPos == 0 && ps.charsUsed == 0 && ps.stream == null ); 2686ps.textReader = input; 2687ps.baseUriStr = baseUriStr; 2688ps.baseUri = baseUri; 2690if ( ps.chars == null ) { 2695ps.chars = new char[XmlReader.AsyncBufferSize + 1]; 2698ps.chars = new char[XmlReader.DefaultBufferSize + 1]; 2703ps.encoding = Encoding.Unicode; 2704ps.eolNormalized = !normalize; 2707ps.appendMode = true; 2712Debug.Assert( ps.stream == null && ps.textReader == null ); 2713Debug.Assert( ps.charPos == 0 && ps.charsUsed == 0 ); 2717ps.baseUriStr = baseUriStr; 2718ps.baseUri = null; 2721ps.chars = new char[ len + 1 ]; 2722str.CopyTo( 0, ps.chars, 0, str.Length ); 2723ps.charsUsed = len; 2724ps.chars[len] = (char)0; 2726ps.encoding = originalEncoding; 2728ps.eolNormalized = !normalize; 2729ps.isEof = true; 2746ps.baseUriStr = parserContext.BaseURI; 2747ps.baseUri = null; 2753ps.baseUriStr = string.Empty; 2754ps.baseUri = null; 2757reportedBaseUri = ps.baseUriStr; 2761ps.appendMode = false; 2775ps.appendMode = false; 2821if ( ps.baseUri != null ) { 2825ps.baseUri = tmpResolver.ResolveUri( null, url ); 2826ps.baseUriStr = ps.baseUri.ToString(); 2837if ( ps.stream == null ) { 2838ThrowWithoutLineInfo( Res.Xml_CannotResolveUrl, ps.baseUriStr ); 2841InitStreamInput( ps.baseUri, ps.baseUriStr, ps.stream, null ); 2842reportedEncoding = ps.encoding; 2847ps.stream = (Stream) GetTempResolver().GetEntity(ps.baseUri, null, typeof(Stream)); 2853Debug.Assert( ps.bytes != null ); 2854Debug.Assert( ps.bytePos == 0 ); 2856if ( ps.bytesUsed < 2 ) { 2859int first2Bytes = ps.bytes[0] << 8 | ps.bytes[1]; 2860int next2Bytes = ( ps.bytesUsed >= 4 ) ? ( ps.bytes[2] << 8 | ps.bytes[3] ) : 0; 2941Debug.Assert( ps.charPos == 0 ); 2942ps.encoding = Encoding.UTF8; 2943ps.decoder = new SafeAsciiDecoder(); 2946ps.encoding = encoding; 2948switch ( ps.encoding.WebName ) { // Encoding.Codepage is not supported in Silverlight 2950ps.decoder = new UTF16Decoder( false ); 2953ps.decoder = new UTF16Decoder( true ); 2956ps.decoder = encoding.GetDecoder(); 2967if ( ( newEncoding.WebName != ps.encoding.WebName || ps.decoder is SafeAsciiDecoder ) && !afterResetState) { 2969Debug.Assert( ps.stream != null ); 2971ps.appendMode = false; 2981if ( ps.stream == null ) { 2982return ps.encoding; 2989if ( ps.encoding.WebName != "utf-16BE" && 2990ps.encoding.WebName != "utf-16" && 3003return ps.encoding; 3027if ( afterResetState && ps.encoding.WebName != newEncoding.WebName ) { 3036Debug.Assert( ps.stream != null && ps.decoder != null && ps.bytes != null ); 3037Debug.Assert( ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false" ); 3039Debug.Assert(ps.charsUsed >= ps.charPos, "The current position must be in the valid character range."); 3046Debug.Assert(charactersInDocument >= ps.charsUsed - ps.charPos, 3048charactersInDocument -= ps.charsUsed - ps.charPos; 3052Debug.Assert(charactersFromEntities >= ps.charsUsed - ps.charPos, 3054charactersFromEntities -= ps.charsUsed - ps.charPos; 3058ps.bytePos = documentStartBytePos; // byte position after preamble 3059if ( ps.charPos > 0 ) { 3060ps.bytePos += ps.encoding.GetByteCount( ps.chars, 0, ps.charPos ); 3062ps.charsUsed = ps.charPos; 3063ps.isEof = false; 3077if ( ps.isEof ) { 3082if ( ps.appendMode ) { 3084if ( ps.charsUsed == ps.chars.Length - 1 ) { 3090char[] newChars = new char[ ps.chars.Length * 2 ]; 3091BlockCopyChars( ps.chars, 0, newChars, 0, ps.chars.Length ); 3092ps.chars = newChars; 3095if ( ps.stream != null ) { 3097if ( ps.bytesUsed - ps.bytePos < MaxByteSequenceLen ) { 3098if ( ps.bytes.Length - ps.bytesUsed < MaxByteSequenceLen ) { 3099byte[] newBytes = new byte[ ps.bytes.Length * 2 ]; 3100BlockCopy( ps.bytes, 0, newBytes, 0, ps.bytesUsed ); 3101ps.bytes = newBytes; 3106charsRead = ps.chars.Length - ps.charsUsed - 1; 3112int charsLen = ps.chars.Length; 3113if ( charsLen - ps.charsUsed <= charsLen/2 ) { 3120int copyCharsCount = ps.charsUsed - ps.charPos; 3122ps.lineStartPos = ps.lineStartPos - ps.charPos; 3124BlockCopyChars( ps.chars, ps.charPos, ps.chars, 0, copyCharsCount ); 3126ps.charPos = 0; 3127ps.charsUsed = copyCharsCount; 3130char[] newChars = new char[ ps.chars.Length * 2 ]; 3131BlockCopyChars( ps.chars, 0, newChars, 0, ps.chars.Length ); 3132ps.chars = newChars; 3136if ( ps.stream != null ) { 3138int bytesLeft = ps.bytesUsed - ps.bytePos; 3141ps.bytesUsed = 0; 3144BlockCopy( ps.bytes, ps.bytePos, ps.bytes, 0, bytesLeft ); 3145ps.bytesUsed = bytesLeft; 3147ps.bytePos = 0; 3150charsRead = ps.chars.Length - ps.charsUsed - 1; 3153if ( ps.stream != null ) { 3154if ( !ps.isStreamEof ) { 3156if ( ps.bytePos == ps.bytesUsed && ps.bytes.Length - ps.bytesUsed > 0 ) { 3157int read = ps.stream.Read( ps.bytes, ps.bytesUsed, ps.bytes.Length - ps.bytesUsed ); 3159ps.isStreamEof = true; 3161ps.bytesUsed += read; 3165int originalBytePos = ps.bytePos; 3169if ( charsRead == 0 && ps.bytePos != originalBytePos ) { 3174else if ( ps.textReader != null ) { 3176charsRead = ps.textReader.Read( ps.chars, ps.charsUsed, ps.chars.Length - ps.charsUsed - 1 ); 3177ps.charsUsed += charsRead; 3186Debug.Assert ( ps.charsUsed < ps.chars.Length ); 3187ps.isEof = true; 3189ps.chars[ ps.charsUsed ] = (char)0; 3195Debug.Assert( ps.stream != null && ps.decoder != null && ps.bytes != null ); 3196Debug.Assert( maxCharsCount <= ps.chars.Length - ps.charsUsed - 1 ); 3199int bytesCount = ps.bytesUsed - ps.bytePos; 3208ps.decoder.Convert( ps.bytes, ps.bytePos, bytesCount, ps.chars, ps.charsUsed, maxCharsCount, false, out bytesCount, out charsCount, out completed ); 3215ps.bytePos += bytesCount; 3216ps.charsUsed += charsCount; 3229ps.decoder.Convert( ps.bytes, ps.bytePos + bytesDecoded, 1, ps.chars, ps.charsUsed + charsDecoded, 1, false, out bDec, out chDec, out completed ); 3239Throw( ps.charsUsed, Res.Xml_InvalidCharInThisEncoding ); 3254ps.Close( closeInput ); 3268BlockCopyChars( ps.chars, sourcePos, ps.chars, destPos, count ); 3273while ( ps.charsUsed - ps.charPos < 6 ) { // minimum "<?xml " 3279if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 5, XmlDeclarationBegining ) || 3280xmlCharType.IsNameSingleChar( ps.chars[ps.charPos + 5] ) 3289curNode.SetLineInfo( ps.LineNo, ps.LinePos + 2 ); 3292ps.charPos += 5; 3307if ( ps.chars[ps.charPos] == '?' ) { 3310if ( ps.chars[ps.charPos + 1] == '>' ) { 3315ps.charPos += 2; 3332string encodingName = ps.encoding.WebName; 3334encodingName != "utf-16BE" && !( ps.encoding is Ucs4Encoding ) ) { 3335Throw( Res.Xml_EncodingSwitchAfterResetState, ( ps.encoding.GetByteCount( "A" ) == 1 ) ? "UTF-8" : "UTF-16" ); 3339if ( ps.decoder is SafeAsciiDecoder ) { 3346ps.appendMode = false; 3349else if ( ps.charPos + 1 == ps.charsUsed ) { 3365switch ( ps.chars[ps.charPos] ) { 3367if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "version" ) && xmlDeclState == 0 ) { 3375if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "encoding" ) && 3385if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "standalone" ) && 3399attr.SetLineInfo( ps.LineNo, ps.LinePos ); 3401sb.Append( ps.chars, ps.charPos, nameEndPos - ps.charPos ); 3402ps.charPos = nameEndPos; 3405if ( ps.chars[ps.charPos] != '=' ) { 3407if ( ps.chars[ps.charPos] != '=' ) { 3412ps.charPos++; 3414char quoteChar = ps.chars[ps.charPos]; 3417quoteChar = ps.chars[ps.charPos]; 3423ps.charPos++; 3426attr.SetLineInfo2( ps.LineNo, ps.LinePos ); 3430int pos = ps.charPos; 3433chars = ps.chars; 3446if ( ps.chars[pos] == quoteChar ) { 3458if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "1.0" ) ) { 3461attr.SetValue( ps.chars, ps.charPos, pos - ps.charPos ); 3466string badVersion = new string( ps.chars, ps.charPos, pos - ps.charPos ); 3471string encName = new string( ps.chars, ps.charPos, pos - ps.charPos ); 3479if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "yes" ) ) { 3482else if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "no" ) ) { 3487Throw( Res.Xml_InvalidXmlDecl, ps.LineNo, ps.LinePos - 1 ); 3490attr.SetValue( ps.chars, ps.charPos, pos - ps.charPos ); 3498sb.Append( chars, ps.charPos, pos - ps.charPos ); 3500ps.charPos = pos + 1; 3503else if ( pos == ps.charsUsed ) { 3516if ( ps.isEof || ReadData() == 0 ) { 3529string encodingName = ps.encoding.WebName; 3531encodingName != "utf-16BE" && !( ps.encoding is Ucs4Encoding ) ) { 3532Throw( Res.Xml_EncodingSwitchAfterResetState, ( ps.encoding.GetByteCount( "A" ) == 1 ) ? "UTF-8" : "UTF-16" ); 3536if ( ps.decoder is SafeAsciiDecoder ) { 3539ps.appendMode = false; 3558int pos = ps.charPos; 3559char[] chars = ps.chars; 3564if ( ps.charsUsed - pos < 4 ) // minimum "<a/>" 3570ps.charPos = pos + 1; 3577if ( ps.charsUsed - pos < 2 ) // minimum characters expected "--" 3582ps.charPos = pos + 2; 3596if ( ps.charsUsed - pos < 6 ) { 3600ps.charPos = pos + 6; 3612Throw( ps.charPos, Res.Xml_InvalidRootData ); 3619ps.charPos = pos; 3648ps.charPos = pos; 3680chars = ps.chars; 3681pos = ps.charPos; 3687else if ( pos == ps.charsUsed || ( ( v1Compat || mangoQuirks ) && chars[pos] == 0x0 ) ) { 3708Debug.Assert( pos == ps.charsUsed && !ps.isEof ); 3713pos = ps.charPos; 3744pos = ps.charPos; 3745chars = ps.chars; 3753int pos = ps.charPos; 3754char[] chars = ps.chars; 3762ps.charPos = pos + 2; 3769if ( ps.charsUsed - pos < 2 ) 3774ps.charPos = pos + 2; 3787if ( ps.charsUsed - pos < 6 ) { 3791ps.charPos = pos + 6; 3811ps.charPos = pos + 2; 3816if ( pos+1 == ps.charsUsed ) { 3821ps.charPos = pos + 1; 3834if ( pos == ps.charsUsed ) { 3849if ( ps.charsUsed - ps.charPos != 0 ) { 3873Throw( ps.charsUsed, Res.Xml_UnexpectedEOF1 ); 3891Throw ( ps.charsUsed, Res.Xml_UnexpectedEOFInElementContent, stringBuilder.ToString() ); 3897int pos = ps.charPos; 3898char[] chars = ps.chars; 3901curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 3964else if ( pos + 1 < ps.charsUsed ) { 3970chars = ps.chars; 3979nameTable.Add( chars, ps.charPos, pos - ps.charPos ) ); 3982int startPos = ps.charPos; 3993nameTable.Add( chars, ps.charPos, prefixLen ), 4010ps.charPos = pos; 4018ps.charPos = pos + 1; 4023if ( pos+1 == ps.charsUsed ) { 4024ps.charPos = pos; 4028pos = ps.charPos; 4029chars = ps.chars; 4035ps.charPos = pos + 2; 4043Throw( pos, Res.Xml_BadNameChar, XmlException.BuildCharExceptionArgs( chars, ps.charsUsed, pos ) ); 4131while ( ps.charsUsed - ps.charPos < prefLen + locLen + 1 ) { 4138char[] chars = ps.chars; 4140if ( !XmlConvert.StrEqual( chars, ps.charPos, locLen, startTagNode.localName ) ) { 4146int colonPos = ps.charPos + prefLen; 4147if ( !XmlConvert.StrEqual( chars, ps.charPos, prefLen, startTagNode.prefix ) || 4155LineInfo endTagLineInfo = new LineInfo( ps.lineNo, ps.LinePos ); 4159pos = ps.charPos + nameLen; 4160chars = ps.chars; 4162if ( pos == ps.charsUsed ) { 4194else if (pos == ps.charsUsed && !ps.isEof) { 4206else if ( pos == ps.charsUsed ) { 4229ps.charPos = pos + 1; 4246args[3] = new string( ps.chars, ps.charPos, endPos - ps.charPos ); 4257int pos = ps.charPos; 4258char[] chars = ps.chars; 4284else if ( pos+1 != ps.charsUsed ) { 4289ps.charPos = pos; 4319ps.charPos = pos + 1; 4326if ( pos+1 == ps.charsUsed ) { 4330ps.charPos = pos + 2; 4340else if ( pos == ps.charsUsed ) { 4344Throw( pos, Res.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs( chars, ps.charsUsed, pos ) ); 4348if ( pos == ps.charPos ) { 4351ps.charPos = pos; 4354int attrNameLinePos = ps.LinePos; 4424chars = ps.chars; 4427else if ( pos + 1 >= ps.charsUsed ) { 4429chars = ps.chars; 4433attr.SetLineInfo( ps.LineNo, attrNameLinePos ); 4441ps.charPos = pos; 4443pos = ps.charPos; 4452ps.charPos = pos; 4454pos = ps.charPos; 4461ps.charPos = pos; 4464attr.SetLineInfo2( ps.LineNo, ps.LinePos ); 4488attr.SetValue( chars, ps.charPos, pos - ps.charPos ); 4490ps.charPos = pos; 4494pos = ps.charPos; 4495chars = ps.chars; 4518ps.lineNo -= lineNoDelta; 4520pos = ps.charPos; 4521chars = ps.chars; 4653char[] chars = ps.chars; 4654int attributeBaseEntityId = ps.entityId; 4657LineInfo valueChunkLineInfo = new LineInfo(ps.lineNo, ps.LinePos); 4677if ( pos - ps.charPos > 0 ) { 4678stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 4679ps.charPos = pos; 4682if ( chars[pos] == quoteChar && attributeBaseEntityId == ps.entityId ) { 4693ps.charPos++; 4700stringBuilder.Append( ps.eolNormalized ? "\u0020\u0020" : "\u0020" ); // CDATA normalization of 0xD 0xA 4701ps.charPos = pos; 4704else if ( pos+1 < ps.charsUsed || ps.isEof ) { 4708ps.charPos = pos; 4721ps.charPos++; 4735if ( pos - ps.charPos > 0 ) { 4736stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 4738ps.charPos = pos; 4741int enclosingEntityId = ps.entityId; 4742LineInfo entityLineInfo = new LineInfo( ps.lineNo, ps.LinePos + 1 ); 4751if ( parsingMode == ParsingMode.Full && ps.entityId == attributeBaseEntityId ) { 4763ps.charPos++; 4780valueChunkLineInfo.Set( ps.LineNo, ps.LinePos ); 4785ps.charPos++; 4788pos = ps.charPos; 4808entityChunk.SetNamedNode( XmlNodeType.EntityReference, ps.entity.Name ); 4816pos = ps.charPos; 4820pos = ps.charPos; 4823chars = ps.chars; 4827if ( pos == ps.charsUsed ) { 4834if ( pos + 1 == ps.charsUsed ) { 4843ThrowInvalidChar( chars, ps.charsUsed, pos ); 4852if ( ps.charsUsed - ps.charPos > 0 ) { 4853if ( ps.chars[ps.charPos] != (char)0xD ) { 4857Debug.Assert( ps.isEof ); 4862if ( attributeBaseEntityId != ps.entityId ) { 4877if ( attributeBaseEntityId == ps.entityId ) { 4879valueChunkLineInfo.Set( ps.LineNo, ps.LinePos ); 4885pos = ps.charPos; 4886chars = ps.chars; 4903ps.charPos = pos + 1; 4938curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 4951curNode.SetValueNode( nodeType, ps.chars, startPos, endPos - startPos ); 4960stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 4965stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 4987curNode.SetValueNode( XmlNodeType.Text, ps.chars, startPos, endPos - startPos ); 4995stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5000stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5053char[] chars = ps.chars; 5054int pos = ps.charPos; 5087if ( !ps.eolNormalized && parsingMode == ParsingMode.Full ) { 5088if ( pos - ps.charPos > 0 ) { 5100ps.charPos++; 5105else if ( pos + 1 < ps.charsUsed || ps.isEof ) { 5106if ( !ps.eolNormalized ) { 5138if ( pos > ps.charPos ) { 5158if ( !xmlCharType.IsWhiteSpace(ps.chars[pos-1]) ) { 5163pos = ps.charPos; 5166chars = ps.chars; 5170if ( ps.charsUsed - pos < 3 && !ps.isEof ) { 5181if ( pos == ps.charsUsed ) { 5188if ( pos + 1 == ps.charsUsed ) { 5198int offset = pos - ps.charPos; 5200chars = ps.chars; 5201pos = ps.charPos + offset; 5205ThrowInvalidChar( ps.chars, ps.charsUsed, ps.charPos + offset ); 5212if ( pos > ps.charPos ) { 5217if ( ps.charsUsed - ps.charPos > 0 ) { 5218if ( ps.chars[ps.charPos] != (char)0xD && ps.chars[ps.charPos] != ']') { 5221Debug.Assert( ps.isEof ); 5241pos = ps.charPos; 5242chars = ps.chars; 5253startPos = ps.charPos; 5255ps.charPos = pos; 5272stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5274stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5380if ( ps.chars[ps.charPos] == '<' || ps.charsUsed - ps.charPos == 0 || ZeroEndingStream( ps.charPos ) ) { 5385curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 5387if ( ps.chars[ps.charPos] == '<' || ps.charsUsed - ps.charPos == 0 || ZeroEndingStream( ps.charPos ) ) { 5397if ( xmlCharType.IsCharData( ps.chars[ps.charPos] ) ) { 5401ThrowInvalidChar( ps.chars, ps.charsUsed, ps.charPos ); 5408Debug.Assert( ps.chars[ps.charPos] == '&' ); 5409ps.charPos++; 5411curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 5417Debug.Assert( ps.chars[ps.charPos] == '&' ); 5419if ( ps.charPos + 1 == ps.charsUsed ) { 5426if ( ps.chars[ps.charPos+1] == '#' ) { 5452ps.charPos++; 5453int savedLinePos = ps.LinePos; 5458Throw( Res.Xml_ErrorParsingEntityName, ps.LineNo, savedLinePos ); 5463if ( ps.chars[endPos] != ';' ) { 5467int entityLinePos = ps.LinePos; 5468string entityName = nameTable.Add( ps.chars, ps.charPos, endPos - ps.charPos ); 5469ps.charPos = endPos + 1; 5473reportedBaseUri = ps.baseUriStr; 5474reportedEncoding = ps.encoding; 5498Throw( Res.Xml_UndeclaredEntity, name, ps.LineNo, entityStartLinePos ); 5510Throw( Res.Xml_UnparsedEntityRef, name, ps.LineNo, entityStartLinePos ); 5514Throw( Res.Xml_ExternalEntityInStandAloneDocument, entity.Name, ps.LineNo, entityStartLinePos ); 5519Throw( Res.Xml_ExternalEntityInAttValue, name, ps.LineNo, entityStartLinePos ); 5530curNode.entityId = ps.entityId; 5537curNode.entityId = ps.entityId; 5552curNode.entityId = ps.entityId; 5579if ( ps.entityResolvedManually ) { 5583if ( ps.entityId != nodes[index].entityId ) { 5588lastEntity = ps.entity; // save last entity for the EndEntity node 5596if ( ps.entityId != nodes[index].entityId ) { 5603reportedEncoding = ps.encoding; 5604reportedBaseUri = ps.baseUriStr; 5615reportedEncoding = ps.encoding; 5616reportedBaseUri = ps.baseUriStr; 5621curNode.lineInfo.Set( ps.lineNo, ps.LinePos - 1 ); 5645curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 5652string target = nameTable.Add( ps.chars, ps.charPos, nameEndPos - ps.charPos ); 5657ps.charPos = nameEndPos; 5669char ch = ps.chars[ps.charPos]; 5670Debug.Assert( ps.charPos < ps.charsUsed ); 5672if ( ps.charsUsed - ps.charPos < 2 ) { 5675if ( ch != '?' || ps.chars[ps.charPos+1] != '>' ) { 5676Throw( Res.Xml_BadNameChar, XmlException.BuildCharExceptionArgs( ps.chars, ps.charsUsed, ps.charPos ) ); 5688curNode.SetValue( ps.chars, startPos, endPos - startPos ); 5692piInDtdStringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5710sb.Append( ps.chars, startPos, endPos - startPos ); 5712sb.Append( ps.chars, startPos, endPos - startPos ); 5724if ( ps.charsUsed - ps.charPos < 2 ) { 5726Throw( ps.charsUsed, Res.Xml_UnexpectedEOF, "PI" ); 5730int pos = ps.charPos; 5731char[] chars = ps.chars; 5757Debug.Assert( !ps.eolNormalized ); 5764outStartPos = ps.charPos; 5765ps.charPos = pos + 2; 5768else if ( pos+1 == ps.charsUsed ) { 5782if ( !ps.eolNormalized && parsingMode == ParsingMode.Full ) { 5784if ( pos - ps.charPos > 0 ) { 5796ps.charPos++; 5801else if ( pos+1 < ps.charsUsed || ps.isEof ) { 5802if ( !ps.eolNormalized ) { 5820if ( pos == ps.charsUsed ) { 5827if ( pos + 1 == ps.charsUsed ) { 5836ThrowInvalidChar( chars, ps.charsUsed, pos ); 5851outStartPos = ps.charPos; 5852ps.charPos = pos; 5879curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 5882curNode.SetValueNode( type, ps.chars, startPos, endPos - startPos ); 5886stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5888stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 5900if ( ps.charsUsed - ps.charPos < 3 ) { 5907int pos = ps.charPos; 5908char[] chars = ps.chars; 5935Debug.Assert( !ps.eolNormalized ); 5942outStartPos = ps.charPos; 5943ps.charPos = pos + 3; 5946else if ( pos+2 == ps.charsUsed ) { 5953else if ( pos+1 == ps.charsUsed ) { 5969if ( !ps.eolNormalized && parsingMode == ParsingMode.Full ) { 5970if ( pos - ps.charPos > 0 ) { 5982ps.charPos++; 5987else if ( pos+1 < ps.charsUsed || ps.isEof ) { 5988if ( !ps.eolNormalized ) { 6006if ( pos == ps.charsUsed ) { 6012if ( pos + 1 == ps.charsUsed ) { 6021ThrowInvalidChar( chars, ps.charsUsed, pos ); 6034outStartPos = ps.charPos; 6036ps.charPos = pos; 6048while ( ps.charsUsed - ps.charPos < 8 ) { 6053if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 7, "DOCTYPE" ) ) { 6056if ( !xmlCharType.IsWhiteSpace( ps.chars[ps.charPos + 7] ) ) { 6057ThrowExpectingWhitespace( ps.charPos + 7 ); 6061Throw( ps.charPos - 2, Res.Xml_MultipleDTDsProvided ); // position just before <!DOCTYPE 6064Throw( ps.charPos - 2, Res.Xml_DtdAfterRootElement ); 6067ps.charPos += 8; 6073curNode.SetLineInfo(ps.LineNo, ps.LinePos); 6112ps.charPos = pos; 6118if ( ps.chars[ps.charPos] == 'P' ) { 6120while ( ps.charsUsed - ps.charPos < 6 ) { 6126if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 6, "PUBLIC" ) ) { 6129ps.charPos += 6; 6133ThrowExpectingWhitespace( ps.charPos ); 6141ThrowExpectingWhitespace( ps.charPos ); 6149else if ( ps.chars[ps.charPos] == 'S' ) { 6151while ( ps.charsUsed - ps.charPos < 6 ) { 6157if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 6, "SYSTEM" ) ) { 6160ps.charPos += 6; 6164ThrowExpectingWhitespace( ps.charPos ); 6172else if ( ps.chars[ps.charPos] != '[' && ps.chars[ps.charPos] != '>' ) { 6177if ( ps.chars[ps.charPos] == '[' ) { 6178ps.charPos++; 6183if ( ps.chars[ps.charPos] != '>' ) { 6187else if ( ps.chars[ps.charPos] == '>' ) { 6193ps.charPos++; 6198char quoteChar = ps.chars[ps.charPos]; 6203ps.charPos++; 6213char[] chars = ps.chars; 6214int pos = ps.charPos; 6233ps.charPos = pos + 1; 6238ps.charPos = pos; 6249else if ( pos+1 < ps.charsUsed || ps.isEof ) { 6270if ( pos + 3 >= ps.charsUsed && !ps.isEof ) { 6282else if ( pos + 1 >= ps.charsUsed && !ps.isEof ) { 6290if ( pos + 2 >= ps.charsUsed && !ps.isEof ) { 6305if (pos + 1 >= ps.charsUsed && !ps.isEof) { 6340if ( pos == ps.charsUsed ) { 6347if ( pos + 1 == ps.charsUsed ) { 6356ThrowInvalidChar( chars, ps.charsUsed, pos ); 6364if ( ps.charsUsed - ps.charPos > 0 ) { 6365if ( ps.chars[ps.charPos] != (char)0xD ) { 6369Debug.Assert( ps.isEof ); 6375chars = ps.chars; 6376pos = ps.charPos; 6381int pos = ps.charPos; 6383char[] chars = ps.chars; 6394int tmp1 = pos - ps.charPos; 6395if ( sb != null && !ps.eolNormalized ) { 6397sb.Append( chars, ps.charPos, tmp1 ); 6400ps.charPos = pos + 1; 6404else if ( pos+1 < ps.charsUsed || ps.isEof ) { 6405if ( !ps.eolNormalized ) { 6420if ( pos == ps.charsUsed ) { 6424int tmp2 = pos - ps.charPos; 6427sb.Append( ps.chars, ps.charPos, tmp2 ); 6429ps.charPos = pos; 6438int tmp3 = pos - ps.charPos; 6441sb.Append( ps.chars, ps.charPos, tmp3 ); 6443ps.charPos = pos; 6448if ( ps.charsUsed - ps.charPos == 0 ) { 6451if ( ps.chars[ps.charPos] != (char)0xD ) { 6455Debug.Assert( ps.isEof ); 6457pos = ps.charPos; 6458chars = ps.chars; 6463Debug.Assert( ps.chars[startPos] == '&' ); 6464if ( ps.chars[startPos + 1] == '#' ) { 6483switch ( newPos = ParseNumericCharRefInline( ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType ) ) { 6489Debug.Assert( ps.chars[ps.charPos] == '&' ); 6493ps.charPos = newPos - charCount; 6507Debug.Assert( ps.chars[startPos] == '&' && ps.chars[startPos + 1] == '#' ); 6515chars = ps.chars; 6539else if ( pos < ps.charsUsed ) { 6555ps.charPos = pos; 6561if ( pos == ps.charsUsed ) { 6575Throw((ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, Res.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(ch, '\0')); 6580internalSubsetBuilder.Append( ps.chars, ps.charPos, pos - ps.charPos + 1 ); 6598Throw((ps.chars[startPos + 2] == 'x') ? startPos + 3 : startPos + 2, Res.Xml_InvalidCharacter, XmlException.BuildCharExceptionArgs(high, low)); 6605internalSubsetBuilder.Append( ps.chars, ps.charPos, pos - ps.charPos + 1 ); 6624switch ( newPos = ParseNamedCharRefInline( ps.charPos, expand, internalSubsetBuilder ) ) { 6632Debug.Assert( ps.chars[ps.charPos] == '&' ); 6636ps.charPos = newPos - 1; 6650Debug.Assert( startPos < ps.charsUsed ); 6651Debug.Assert( ps.chars[startPos] == '&' ); 6652Debug.Assert( ps.chars[startPos + 1] != '#' ); 6655char[] chars = ps.chars; 6664if ( ps.charsUsed - pos >= 3 ) { 6677if ( ps.charsUsed - pos >= 4 ) { 6689else if ( pos < ps.charsUsed ) { 6695if ( ps.charsUsed - pos >= 5 ) { 6709if ( ps.charsUsed - pos >= 3 ) { 6722if ( ps.charsUsed - pos >= 3 ) { 6744internalSubsetBuilder.Append( ps.chars, ps.charPos, pos - ps.charPos ); 6746ps.chars[pos-1] = ch; 6762int pos = ps.charPos + startOffset; 6765char[] chars = ps.chars; 6782if ( pos + 1 >= ps.charsUsed ) { 6789Throw( pos, Res.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs( chars, ps.charsUsed, pos ) ); 6822colonOffset = pos - ps.charPos; 6827colonOffset = pos - ps.charPos; 6833else if ( pos == ps.charsUsed 6839chars = ps.chars; 6846colonPos = ( colonOffset == -1 ) ? -1 : ps.charPos + colonOffset; 6851int offset = pos - ps.charPos; 6853pos = ps.charPos + offset; 6869if ( ps.chars[endPos] != ';' ) { 6873string entityName = nameTable.Add( ps.chars, ps.charPos, endPos - ps.charPos ); 6874ps.charPos = endPos + 1; 6921string localName = nameTable.Add( ps.chars, ps.charPos, endNamePos - ps.charPos ); 6926int startPos = ps.charPos; 6928if ( prefixLen == lastPrefix.Length && XmlConvert.StrEqual( ps.chars, startPos, prefixLen, lastPrefix ) ) { 6929return AddAttribute( nameTable.Add( ps.chars, colonPos + 1, endNamePos - colonPos - 1 ), 6934string prefix = nameTable.Add( ps.chars, startPos, prefixLen ); 6936return AddAttribute( nameTable.Add( ps.chars, colonPos + 1, endNamePos - colonPos - 1 ), 6985ps.lineNo++; 6986ps.lineStartPos = pos - 1; 6990Debug.Assert( ps.isEof ); 6993curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 7201Debug.Assert( ps.appendMode ); 7202int initialPos = ps.charPos; 7207ps.charPos = initialPos; 7212Encoding enc = ps.encoding; 7228Encoding enc = ps.encoding; 7236ps.lineNo = entity.LineNumber; 7237ps.lineStartPos = - entity.LinePosition - 1; 7239ps.eolNormalized = true; 7245if ( ps.stream != null ) { 7246ps.stream.Close(); 7250curNode.entityId = ps.entityId; 7263ps.entity = entity; 7264ps.entityId = nextEntityId++; 7277if (ps.entity != null) { 7278currentEntities.Remove(ps.entity); 7293parsingStatesStack[ parsingStatesStackTop ] = ps; 7295ps.Clear(); 7300ps.Close( true ); 7312incReadLeftStartPos = ps.charPos; 7313incReadLeftEndPos = ps.charPos; 7314incReadLineInfo.Set( ps.LineNo, ps.LinePos ); 7352count = incReadDecoder.Decode( ps.chars, incReadLeftStartPos, charsLeft ); 7385Debug.Assert( XmlConvert.StrEqual( ps.chars, ps.charPos - 2, 2, "?>" ) ); 7386ps.charPos -= 2; 7392Debug.Assert( XmlConvert.StrEqual( ps.chars, ps.charPos - 3, 3, "-->" ) ); 7393ps.charPos -= 3; 7399Debug.Assert( XmlConvert.StrEqual( ps.chars, ps.charPos - 3, 3, "]]>" ) ); 7400ps.charPos -= 3; 7418startPos = ps.charPos; 7429char[] chars = ps.chars; 7430startPos = ps.charPos; 7434incReadLineInfo.Set( ps.LineNo, ps.LinePos ); 7469else if ( pos+1 < ps.charsUsed ) { 7483if ( ps.charsUsed - pos < 2 ) { 7494if ( ps.charsUsed - pos < 4 ) { 7502if ( ps.charsUsed - pos < 9 ) { 7517Debug.Assert( ps.charPos - pos == 0 ); 7518Debug.Assert( ps.charPos - startPos == 0); 7523if ( XmlConvert.StrEqual( chars, ps.charPos + 2, endPos - ps.charPos - 2, curNode.GetNameWPrefix( nameTable ) ) && 7524( ps.chars[endPos] == '>' || xmlCharType.IsWhiteSpace( ps.chars[endPos] ) ) ) { 7531ps.charPos = endPos; 7532if ( xmlCharType.IsWhiteSpace( ps.chars[endPos] ) ) { 7535if ( ps.chars[ps.charPos] != '>' ) { 7538ps.charPos++; 7545startPos = ps.charPos; 7546chars = ps.chars; 7553Debug.Assert( ps.charPos - pos == 0 ); 7554Debug.Assert( ps.charPos - startPos == 0 ); 7559if ( XmlConvert.StrEqual( ps.chars, ps.charPos + 1, endPos - ps.charPos - 1, curNode.localName ) && 7560( ps.chars[endPos] == '>' || ps.chars[endPos] == '/' || xmlCharType.IsWhiteSpace( ps.chars[endPos] ) ) ) { 7567startPos = ps.charPos; 7568chars = ps.chars; 7576if ( ps.charsUsed - pos < 2 ) { 7610if ( pos == ps.charsUsed ) { 7625ps.charPos = pos; 7633count = incReadDecoder.Decode( ps.chars, startPos, charsParsed ); 7665ParseAttributeValueSlow( ps.charPos, ' ', curNode ); // The quote char is intentionally empty (space) because we need to parse ' and " into the attribute value 7687char[] chars = ps.chars; 7688int pos = ps.charPos; 7691curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 7710Debug.Assert( ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!" ); 7732if ( pos - ps.charPos > 0 ) { 7733stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 7735ps.charPos = pos; 7742chars = ps.chars; 7743if ( normalize && xmlCharType.IsWhiteSpace( chars[ps.charPos] ) && pos - ps.charPos == 1 ) { 7744chars[ps.charPos] = (char)0x20; // CDATA normalization of character references in entities 7750ps.charPos++; 7761chars = ps.chars; 7765if ( pos == ps.charsUsed ) { 7772if ( pos + 1 == ps.charsUsed ) { 7781ThrowInvalidChar( chars, ps.charsUsed, pos ); 7787if ( pos - ps.charPos > 0 ) { 7788stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 7789ps.charPos = pos; 7807pos = ps.charPos; 7808chars = ps.chars; 7812if ( pos - ps.charPos > 0 ) { 7813stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 7814ps.charPos = pos; 7840ps.charPos = pos; 7858ps.charPos = pos; 7863if ( ps.charPos == ps.charsUsed ) { 7866if ( xmlCharType.IsNCNameSingleChar( ps.chars[ps.charPos] ) ) { 7867int pos = ps.charPos + 1; 7868while ( xmlCharType.IsNCNameSingleChar( ps.chars[pos] ) ) { 7871return new string( ps.chars, ps.charPos, pos - ps.charPos ); 7874Debug.Assert( ps.charPos < ps.charsUsed ); 7875return new string( ps.chars, ps.charPos, 1 ); 7922if ( v1Compat && pos == ps.charsUsed - 1 && ps.chars[pos] == (char)0 && ReadData() == 0 && ps.isStreamEof ) { 7923ps.charsUsed--; 8360curNode.AdjustLineInfo( readValueOffset, ps.eolNormalized, ref incReadLineInfo ); 8381incReadLineInfo.Set( ps.LineNo, ps.LinePos ); 8385charsRead = incReadDecoder.Decode( ps.chars, startPos, endPos - startPos ); 8397curNode.SetValue( ps.chars, startPos, endPos - startPos ); 8399AdjustLineInfo( ps.chars, startPos - charsRead, startPos, ps.eolNormalized, ref incReadLineInfo );
System\Xml\Core\XmlTextReaderImplAsync.cs (671)
93reportedEncoding = ps.encoding; 120reportedEncoding = ps.encoding; 134reportedEncoding = ps.encoding; 165Debug.Assert(!ps.appendMode); 206reportedEncoding = ps.encoding; 207reportedBaseUri = ps.baseUriStr; 213curNode.SetLineInfo(ps.lineNo, ps.LinePos); 214reportedEncoding = ps.encoding; 215reportedBaseUri = ps.baseUriStr; 278reportedEncoding = ps.encoding; 282reportedEncoding = ps.encoding; 665BlockCopyChars( ps.chars, startPos, buffer, ( index + readCount ), copyCount ); 685curNode.SetValue( ps.chars, startPos, endPos - startPos ); 744if ( e.ResString == Res.Xml_UnexpectedEOF && ps.entity != null ) { 745SendValidationEvent( XmlSeverityType.Error, Res.Sch_ParEntityRefNesting, null, ps.LineNo, ps.LinePos ); 774entityId = ps.entityId; 796if (ps.baseUri == null && !string.IsNullOrEmpty(ps.baseUriStr)) { 797ps.baseUri = xmlResolver.ResolveUri(null, ps.baseUriStr); 799await PushExternalEntityOrSubsetAsync( publicId, systemId, ps.baseUri, null ).ConfigureAwait(false); 801ps.entity = null; 802ps.entityId = 0; 804Debug.Assert( ps.appendMode ); 805int initialPos = ps.charPos; 810ps.charPos = initialPos; 828Debug.Assert( ps.charPos == 0 && ps.charsUsed == 0 && ps.textReader == null ); 832ps.stream = stream; 833ps.baseUri = baseUri; 834ps.baseUriStr = baseUriStr; 839ps.bytes = bytes; 840ps.bytesUsed = byteCount; 841bufferSize = ps.bytes.Length; 853if ( ps.bytes == null || ps.bytes.Length < bufferSize ) { 854ps.bytes = new byte[ bufferSize ]; 859if ( ps.chars == null || ps.chars.Length < bufferSize + 1 ) { 860ps.chars = new char[ bufferSize + 1 ]; 864ps.bytePos = 0; 865while ( ps.bytesUsed < 4 && ps.bytes.Length - ps.bytesUsed > 0 ) { 866int read = await stream.ReadAsync( ps.bytes, ps.bytesUsed, ps.bytes.Length - ps.bytesUsed ).ConfigureAwait(false); 868ps.isStreamEof = true; 871ps.bytesUsed += read; 881byte[] preamble = ps.encoding.GetPreamble(); 884for ( i = 0; i < preambleLen && i < ps.bytesUsed; i++ ) { 885if ( ps.bytes[i] != preamble[i] ) { 890ps.bytePos = preambleLen; 893documentStartBytePos = ps.bytePos; 895ps.eolNormalized = !normalize; 898ps.appendMode = true; 906Debug.Assert( ps.charPos == 0 && ps.charsUsed == 0 && ps.stream == null ); 909ps.textReader = input; 910ps.baseUriStr = baseUriStr; 911ps.baseUri = baseUri; 913if ( ps.chars == null ) { 925ps.chars = new char[bufferSize + 1]; 928ps.encoding = Encoding.Unicode; 929ps.eolNormalized = !normalize; 932ps.appendMode = true; 963if ( ( newEncoding.WebName != ps.encoding.WebName || ps.decoder is SafeAsciiDecoder ) && !afterResetState) { 965Debug.Assert( ps.stream != null ); 967ps.appendMode = false; 987if ( ps.isEof ) { 992if ( ps.appendMode ) { 994if ( ps.charsUsed == ps.chars.Length - 1 ) { 1000char[] newChars = new char[ ps.chars.Length * 2 ]; 1001BlockCopyChars( ps.chars, 0, newChars, 0, ps.chars.Length ); 1002ps.chars = newChars; 1005if ( ps.stream != null ) { 1007if ( ps.bytesUsed - ps.bytePos < MaxByteSequenceLen ) { 1008if ( ps.bytes.Length - ps.bytesUsed < MaxByteSequenceLen ) { 1009byte[] newBytes = new byte[ ps.bytes.Length * 2 ]; 1010BlockCopy( ps.bytes, 0, newBytes, 0, ps.bytesUsed ); 1011ps.bytes = newBytes; 1016charsRead = ps.chars.Length - ps.charsUsed - 1; 1022int charsLen = ps.chars.Length; 1023if ( charsLen - ps.charsUsed <= charsLen/2 ) { 1030int copyCharsCount = ps.charsUsed - ps.charPos; 1032ps.lineStartPos = ps.lineStartPos - ps.charPos; 1034BlockCopyChars( ps.chars, ps.charPos, ps.chars, 0, copyCharsCount ); 1036ps.charPos = 0; 1037ps.charsUsed = copyCharsCount; 1040char[] newChars = new char[ ps.chars.Length * 2 ]; 1041BlockCopyChars( ps.chars, 0, newChars, 0, ps.chars.Length ); 1042ps.chars = newChars; 1046if ( ps.stream != null ) { 1048int bytesLeft = ps.bytesUsed - ps.bytePos; 1051ps.bytesUsed = 0; 1054BlockCopy( ps.bytes, ps.bytePos, ps.bytes, 0, bytesLeft ); 1055ps.bytesUsed = bytesLeft; 1057ps.bytePos = 0; 1060charsRead = ps.chars.Length - ps.charsUsed - 1; 1063if ( ps.stream != null ) { 1064if ( !ps.isStreamEof ) { 1066if ( ps.bytePos == ps.bytesUsed && ps.bytes.Length - ps.bytesUsed > 0 ) { 1067int read = await ps.stream.ReadAsync( ps.bytes, ps.bytesUsed, ps.bytes.Length - ps.bytesUsed ).ConfigureAwait(false); 1069ps.isStreamEof = true; 1071ps.bytesUsed += read; 1075int originalBytePos = ps.bytePos; 1079if ( charsRead == 0 && ps.bytePos != originalBytePos ) { 1084else if ( ps.textReader != null ) { 1086charsRead = await ps.textReader.ReadAsync( ps.chars, ps.charsUsed, ps.chars.Length - ps.charsUsed - 1 ).ConfigureAwait(false); 1087ps.charsUsed += charsRead; 1096Debug.Assert ( ps.charsUsed < ps.chars.Length ); 1097ps.isEof = true; 1099ps.chars[ ps.charsUsed ] = (char)0; 1105while ( ps.charsUsed - ps.charPos < 6 ) { // minimum "<?xml " 1111if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 5, XmlDeclarationBegining ) || 1112xmlCharType.IsNameSingleChar( ps.chars[ps.charPos + 5] ) 1121curNode.SetLineInfo( ps.LineNo, ps.LinePos + 2 ); 1124ps.charPos += 5; 1139if ( ps.chars[ps.charPos] == '?' ) { 1142if ( ps.chars[ps.charPos + 1] == '>' ) { 1147ps.charPos += 2; 1164string encodingName = ps.encoding.WebName; 1166encodingName != "utf-16BE" && !( ps.encoding is Ucs4Encoding ) ) { 1167Throw( Res.Xml_EncodingSwitchAfterResetState, ( ps.encoding.GetByteCount( "A" ) == 1 ) ? "UTF-8" : "UTF-16" ); 1171if ( ps.decoder is SafeAsciiDecoder ) { 1178ps.appendMode = false; 1181else if ( ps.charPos + 1 == ps.charsUsed ) { 1197switch ( ps.chars[ps.charPos] ) { 1199if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "version" ) && xmlDeclState == 0 ) { 1207if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "encoding" ) && 1217if ( XmlConvert.StrEqual( ps.chars, ps.charPos, nameEndPos - ps.charPos, "standalone" ) && 1231attr.SetLineInfo( ps.LineNo, ps.LinePos ); 1233sb.Append( ps.chars, ps.charPos, nameEndPos - ps.charPos ); 1234ps.charPos = nameEndPos; 1237if ( ps.chars[ps.charPos] != '=' ) { 1239if ( ps.chars[ps.charPos] != '=' ) { 1244ps.charPos++; 1246char quoteChar = ps.chars[ps.charPos]; 1249quoteChar = ps.chars[ps.charPos]; 1255ps.charPos++; 1258attr.SetLineInfo2( ps.LineNo, ps.LinePos ); 1262int pos = ps.charPos; 1265chars = ps.chars; 1279if ( ps.chars[pos] == quoteChar ) { 1291if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "1.0" ) ) { 1294attr.SetValue( ps.chars, ps.charPos, pos - ps.charPos ); 1299string badVersion = new string( ps.chars, ps.charPos, pos - ps.charPos ); 1304string encName = new string( ps.chars, ps.charPos, pos - ps.charPos ); 1312if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "yes" ) ) { 1315else if ( XmlConvert.StrEqual( ps.chars, ps.charPos, pos - ps.charPos, "no" ) ) { 1320Throw( Res.Xml_InvalidXmlDecl, ps.LineNo, ps.LinePos - 1 ); 1323attr.SetValue( ps.chars, ps.charPos, pos - ps.charPos ); 1331sb.Append( chars, ps.charPos, pos - ps.charPos ); 1333ps.charPos = pos + 1; 1336else if ( pos == ps.charsUsed ) { 1349if ( ps.isEof || await ReadDataAsync().ConfigureAwait(false) == 0 ) { 1362string encodingName = ps.encoding.WebName; 1364encodingName != "utf-16BE" && !( ps.encoding is Ucs4Encoding ) ) { 1365Throw( Res.Xml_EncodingSwitchAfterResetState, ( ps.encoding.GetByteCount( "A" ) == 1 ) ? "UTF-8" : "UTF-16" ); 1369if ( ps.decoder is SafeAsciiDecoder ) { 1372ps.appendMode = false; 1382int pos = ps.charPos; 1383char[] chars = ps.chars; 1388if (ps.charsUsed - pos < 4) // minimum "<a/>" 1394ps.charPos = pos + 1; 1398if (ps.charsUsed - pos < 2) // minimum characters expected "--" 1403ps.charPos = pos + 2; 1414if (ps.charsUsed - pos < 6) { 1418ps.charPos = pos + 6; 1426Throw(ps.charPos, Res.Xml_InvalidRootData); 1433ps.charPos = pos; 1459ps.charPos = pos; 1468else if (pos == ps.charsUsed || (v1Compat && chars[pos] == 0x0)) { 1481Debug.Assert(pos == ps.charsUsed && !ps.isEof); 1494int pos = ps.charPos; 1597int pos = ps.charPos; 1598char[] chars = ps.chars; 1606ps.charPos = pos + 2; 1610if (ps.charsUsed - pos < 2) 1615ps.charPos = pos + 2; 1625if (ps.charsUsed - pos < 6) { 1629ps.charPos = pos + 6; 1648ps.charPos = pos + 2; 1652if (pos + 1 == ps.charsUsed) { 1657ps.charPos = pos + 1; 1666if (pos == ps.charsUsed) { 1680if (ps.charsUsed - ps.charPos != 0) { 1704int pos = ps.charPos; 1705char[] chars = ps.chars; 1708curNode.SetLineInfo(ps.LineNo, ps.LinePos); 1773else if (pos + 1 < ps.charsUsed) { 1805char[] chars = ps.chars; 1813nameTable.Add(chars, ps.charPos, pos - ps.charPos)); 1816int startPos = ps.charPos; 1827nameTable.Add(chars, ps.charPos, prefixLen), 1845ps.charPos = pos; 1857int pos = ps.charPos; 1858char[] chars = ps.chars; 1862ps.charPos = pos + 1; 1867if (pos + 1 == ps.charsUsed) { 1868ps.charPos = pos; 1875ps.charPos = pos + 2; 1883Throw(pos, Res.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, ps.charsUsed, pos)); 1911if (ps.charsUsed - ps.charPos < prefLen + locLen + 1) { 1930while (ps.charsUsed - ps.charPos < prefLen + locLen + 1) { 1944char[] chars = ps.chars; 1946if (!XmlConvert.StrEqual(chars, ps.charPos, locLen, startTagNode.localName)) { 1952int colonPos = ps.charPos + prefLen; 1953if (!XmlConvert.StrEqual(chars, ps.charPos, prefLen, startTagNode.prefix) || 1960LineInfo endTagLineInfo = new LineInfo(ps.lineNo, ps.LinePos); 2015pos = ps.charPos + nameLen; 2016chars = ps.chars; 2018if (pos == ps.charsUsed) { 2057else if (pos == ps.charsUsed && !ps.isEof) { 2069else if (pos == ps.charsUsed) { 2088ps.charPos = pos + 1; 2120args[3] = new string( ps.chars, ps.charPos, endPos - ps.charPos ); 2131int pos = ps.charPos; 2132char[] chars = ps.chars; 2159else if ( pos+1 != ps.charsUsed ) { 2164ps.charPos = pos; 2194ps.charPos = pos + 1; 2201if ( pos+1 == ps.charsUsed ) { 2205ps.charPos = pos + 2; 2215else if ( pos == ps.charsUsed ) { 2219Throw( pos, Res.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs( chars, ps.charsUsed, pos ) ); 2223if ( pos == ps.charPos ) { 2226ps.charPos = pos; 2229int attrNameLinePos = ps.LinePos; 2305chars = ps.chars; 2308else if ( pos + 1 >= ps.charsUsed ) { 2315chars = ps.chars; 2319attr.SetLineInfo( ps.LineNo, attrNameLinePos ); 2327ps.charPos = pos; 2329pos = ps.charPos; 2338ps.charPos = pos; 2340pos = ps.charPos; 2347ps.charPos = pos; 2350attr.SetLineInfo2( ps.LineNo, ps.LinePos ); 2374attr.SetValue( chars, ps.charPos, pos - ps.charPos ); 2376ps.charPos = pos; 2380pos = ps.charPos; 2381chars = ps.chars; 2404ps.lineNo -= lineNoDelta; 2406pos = ps.charPos; 2407chars = ps.chars; 2435char[] chars = ps.chars; 2436int attributeBaseEntityId = ps.entityId; 2439LineInfo valueChunkLineInfo = new LineInfo(ps.lineNo, ps.LinePos); 2459if ( pos - ps.charPos > 0 ) { 2460stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 2461ps.charPos = pos; 2464if ( chars[pos] == quoteChar && attributeBaseEntityId == ps.entityId ) { 2475ps.charPos++; 2482stringBuilder.Append( ps.eolNormalized ? "\u0020\u0020" : "\u0020" ); // CDATA normalization of 0xD 0xA 2483ps.charPos = pos; 2486else if ( pos+1 < ps.charsUsed || ps.isEof ) { 2490ps.charPos = pos; 2503ps.charPos++; 2517if ( pos - ps.charPos > 0 ) { 2518stringBuilder.Append( chars, ps.charPos, pos - ps.charPos ); 2520ps.charPos = pos; 2523int enclosingEntityId = ps.entityId; 2524LineInfo entityLineInfo = new LineInfo( ps.lineNo, ps.LinePos + 1 ); 2538if ( parsingMode == ParsingMode.Full && ps.entityId == attributeBaseEntityId ) { 2550ps.charPos++; 2567valueChunkLineInfo.Set( ps.LineNo, ps.LinePos ); 2572ps.charPos++; 2575pos = ps.charPos; 2595entityChunk.SetNamedNode( XmlNodeType.EntityReference, ps.entity.Name ); 2603pos = ps.charPos; 2607pos = ps.charPos; 2610chars = ps.chars; 2614if ( pos == ps.charsUsed ) { 2621if ( pos + 1 == ps.charsUsed ) { 2630ThrowInvalidChar( chars, ps.charsUsed, pos ); 2639if ( ps.charsUsed - ps.charPos > 0 ) { 2640if ( ps.chars[ps.charPos] != (char)0xD ) { 2644Debug.Assert( ps.isEof ); 2649if ( attributeBaseEntityId != ps.entityId ) { 2664if ( attributeBaseEntityId == ps.entityId ) { 2666valueChunkLineInfo.Set( ps.LineNo, ps.LinePos ); 2672pos = ps.charPos; 2673chars = ps.chars; 2690ps.charPos = pos + 1; 2706curNode.SetLineInfo(ps.LineNo, ps.LinePos); 2733curNode.SetValueNode(nodeType, ps.chars, startPos, endPos - startPos); 2770curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 2791curNode.SetValueNode( nodeType, ps.chars, startPos, endPos - startPos ); 2803stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 2814stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 2836curNode.SetValueNode( XmlNodeType.Text, ps.chars, startPos, endPos - startPos ); 2844stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 2856stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 2959Task<Tuple<int, int, int, bool>> task = ParseTextAsync(outOrChars, ps.chars, ps.charPos, 0, -1, outOrChars, (char)0); 3059if (!ps.eolNormalized && parsingMode == ParsingMode.Full) { 3060if (pos - ps.charPos > 0) { 3072ps.charPos++; 3077else if (pos + 1 < ps.charsUsed || ps.isEof) { 3078if (!ps.eolNormalized) { 3101if (ps.charsUsed - pos < 3 && !ps.isEof) { 3114if (pos == ps.charsUsed) { 3147if (pos > ps.charPos) { 3176if (!xmlCharType.IsWhiteSpace(ps.chars[pos - 1])) { 3181pos = ps.charPos; 3184chars = ps.chars; 3195if (pos + 1 == ps.charsUsed) { 3209int offset = pos - ps.charPos; 3211chars = ps.chars; 3212pos = ps.charPos + offset; 3218ThrowInvalidChar(ps.chars, ps.charsUsed, ps.charPos + offset); 3226if (pos > ps.charPos) { 3233if (ps.charsUsed - ps.charPos > 0) { 3234if (ps.chars[ps.charPos] != (char)0xD && ps.chars[ps.charPos] != ']') { 3237Debug.Assert(ps.isEof); 3261pos = ps.charPos; 3262chars = ps.chars; 3276int startPos = ps.charPos; 3278ps.charPos = pos; 3304stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 3312stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 3430if ( ps.chars[ps.charPos] == '<' || ps.charsUsed - ps.charPos == 0 || await ZeroEndingStreamAsync( ps.charPos ).ConfigureAwait(false) ) { 3435curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 3437if ( ps.chars[ps.charPos] == '<' || ps.charsUsed - ps.charPos == 0 || await ZeroEndingStreamAsync( ps.charPos ).ConfigureAwait(false) ) { 3447if ( xmlCharType.IsCharData( ps.chars[ps.charPos] ) ) { 3451ThrowInvalidChar( ps.chars, ps.charsUsed, ps.charPos ); 3458Debug.Assert( ps.chars[ps.charPos] == '&' ); 3459ps.charPos++; 3461curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 3469Debug.Assert( ps.chars[ps.charPos] == '&' ); 3471if ( ps.charPos + 1 == ps.charsUsed ) { 3478if ( ps.chars[ps.charPos+1] == '#' ) { 3515ps.charPos++; 3516int savedLinePos = ps.LinePos; 3521Throw( Res.Xml_ErrorParsingEntityName, ps.LineNo, savedLinePos ); 3528if ( ps.chars[endPos] != ';' ) { 3532int entityLinePos = ps.LinePos; 3533string entityName = nameTable.Add( ps.chars, ps.charPos, endPos - ps.charPos ); 3534ps.charPos = endPos + 1; 3538reportedBaseUri = ps.baseUriStr; 3539reportedEncoding = ps.encoding; 3565Throw( Res.Xml_UndeclaredEntity, name, ps.LineNo, entityStartLinePos ); 3577Throw( Res.Xml_UnparsedEntityRef, name, ps.LineNo, entityStartLinePos ); 3581Throw( Res.Xml_ExternalEntityInStandAloneDocument, entity.Name, ps.LineNo, entityStartLinePos ); 3586Throw( Res.Xml_ExternalEntityInAttValue, name, ps.LineNo, entityStartLinePos ); 3597curNode.entityId = ps.entityId; 3604curNode.entityId = ps.entityId; 3619curNode.entityId = ps.entityId; 3636curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 3643string target = nameTable.Add( ps.chars, ps.charPos, nameEndPos - ps.charPos ); 3648ps.charPos = nameEndPos; 3660char ch = ps.chars[ps.charPos]; 3661Debug.Assert( ps.charPos < ps.charsUsed ); 3663if ( ps.charsUsed - ps.charPos < 2 ) { 3666if ( ch != '?' || ps.chars[ps.charPos+1] != '>' ) { 3667Throw( Res.Xml_BadNameChar, XmlException.BuildCharExceptionArgs( ps.chars, ps.charsUsed, ps.charPos ) ); 3685curNode.SetValue( ps.chars, startPos, endPos - startPos ); 3689piInDtdStringBuilder.Append( ps.chars, startPos, endPos - startPos ); 3717sb.Append( ps.chars, startPos, endPos - startPos ); 3725sb.Append( ps.chars, startPos, endPos - startPos ); 3740if ( ps.charsUsed - ps.charPos < 2 ) { 3742Throw( ps.charsUsed, Res.Xml_UnexpectedEOF, "PI" ); 3746int pos = ps.charPos; 3747char[] chars = ps.chars; 3774Debug.Assert( !ps.eolNormalized ); 3781outStartPos = ps.charPos; 3782ps.charPos = pos + 2; 3787else if ( pos+1 == ps.charsUsed ) { 3801if ( !ps.eolNormalized && parsingMode == ParsingMode.Full ) { 3803if ( pos - ps.charPos > 0 ) { 3815ps.charPos++; 3820else if ( pos+1 < ps.charsUsed || ps.isEof ) { 3821if ( !ps.eolNormalized ) { 3839if ( pos == ps.charsUsed ) { 3846if ( pos + 1 == ps.charsUsed ) { 3855ThrowInvalidChar( chars, ps.charsUsed, pos ); 3870outStartPos = ps.charPos; 3871ps.charPos = pos; 3900curNode.SetLineInfo( ps.LineNo, ps.LinePos ); 3909curNode.SetValueNode( type, ps.chars, startPos, endPos - startPos ); 3916stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 3924stringBuilder.Append( ps.chars, startPos, endPos - startPos ); 3948if ( ps.charsUsed - ps.charPos < 3 ) { 3955int pos = ps.charPos; 3956char[] chars = ps.chars; 3983Debug.Assert( !ps.eolNormalized ); 3990outStartPos = ps.charPos; 3991ps.charPos = pos + 3; 3996else if ( pos+2 == ps.charsUsed ) { 4003else if ( pos+1 == ps.charsUsed ) { 4019if ( !ps.eolNormalized && parsingMode == ParsingMode.Full ) { 4020if ( pos - ps.charPos > 0 ) { 4032ps.charPos++; 4037else if ( pos+1 < ps.charsUsed || ps.isEof ) { 4038if ( !ps.eolNormalized ) { 4056if ( pos == ps.charsUsed ) { 4062if ( pos + 1 == ps.charsUsed ) { 4071ThrowInvalidChar( chars, ps.charsUsed, pos ); 4084outStartPos = ps.charPos; 4086ps.charPos = pos; 4100while ( ps.charsUsed - ps.charPos < 8 ) { 4105if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 7, "DOCTYPE" ) ) { 4108if ( !xmlCharType.IsWhiteSpace( ps.chars[ps.charPos + 7] ) ) { 4109ThrowExpectingWhitespace( ps.charPos + 7 ); 4113Throw( ps.charPos - 2, Res.Xml_MultipleDTDsProvided ); // position just before <!DOCTYPE 4116Throw( ps.charPos - 2, Res.Xml_DtdAfterRootElement ); 4119ps.charPos += 8; 4125curNode.SetLineInfo(ps.LineNo, ps.LinePos); 4169ps.charPos = pos; 4175if ( ps.chars[ps.charPos] == 'P' ) { 4177while ( ps.charsUsed - ps.charPos < 6 ) { 4183if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 6, "PUBLIC" ) ) { 4186ps.charPos += 6; 4190ThrowExpectingWhitespace( ps.charPos ); 4198ThrowExpectingWhitespace( ps.charPos ); 4206else if ( ps.chars[ps.charPos] == 'S' ) { 4208while ( ps.charsUsed - ps.charPos < 6 ) { 4214if ( !XmlConvert.StrEqual( ps.chars, ps.charPos, 6, "SYSTEM" ) ) { 4217ps.charPos += 6; 4221ThrowExpectingWhitespace( ps.charPos ); 4229else if ( ps.chars[ps.charPos] != '[' && ps.chars[ps.charPos] != '>' ) { 4234if ( ps.chars[ps.charPos] == '[' ) { 4235ps.charPos++; 4240if ( ps.chars[ps.charPos] != '>' ) { 4244else if ( ps.chars[ps.charPos] == '>' ) { 4250ps.charPos++; 4255char quoteChar = ps.chars[ps.charPos]; 4260ps.charPos++; 4270char[] chars = ps.chars; 4271int pos = ps.charPos; 4290ps.charPos = pos + 1; 4295ps.charPos = pos; 4306else if ( pos+1 < ps.charsUsed || ps.isEof ) { 4327if ( pos + 3 >= ps.charsUsed && !ps.isEof ) { 4339else if ( pos + 1 >= ps.charsUsed && !ps.isEof ) { 4347if ( pos + 2 >= ps.charsUsed && !ps.isEof ) { 4362if (pos + 1 >= ps.charsUsed && !ps.isEof) { 4397if ( pos == ps.charsUsed ) { 4404if ( pos + 1 == ps.charsUsed ) { 4413ThrowInvalidChar( chars, ps.charsUsed, pos ); 4421if ( ps.charsUsed - ps.charPos > 0 ) { 4422if ( ps.chars[ps.charPos] != (char)0xD ) { 4426Debug.Assert( ps.isEof ); 4432chars = ps.chars; 4433pos = ps.charPos; 4438int pos = ps.charPos; 4440char[] chars = ps.chars; 4451int tmp1 = pos - ps.charPos; 4452if ( sb != null && !ps.eolNormalized ) { 4454sb.Append( chars, ps.charPos, tmp1 ); 4457ps.charPos = pos + 1; 4461else if ( pos+1 < ps.charsUsed || ps.isEof ) { 4462if ( !ps.eolNormalized ) { 4477if ( pos == ps.charsUsed ) { 4481int tmp2 = pos - ps.charPos; 4484sb.Append( ps.chars, ps.charPos, tmp2 ); 4486ps.charPos = pos; 4495int tmp3 = pos - ps.charPos; 4498sb.Append( ps.chars, ps.charPos, tmp3 ); 4500ps.charPos = pos; 4505if ( ps.charsUsed - ps.charPos == 0 ) { 4508if ( ps.chars[ps.charPos] != (char)0xD ) { 4512Debug.Assert( ps.isEof ); 4514pos = ps.charPos; 4515chars = ps.chars; 4531switch ( newPos = ParseNumericCharRefInline( ps.charPos, expand, internalSubsetBuilder, out charCount, out entityType ) ) { 4537Debug.Assert( ps.chars[ps.charPos] == '&' ); 4541ps.charPos = newPos - charCount; 4559switch ( newPos = ParseNamedCharRefInline( ps.charPos, expand, internalSubsetBuilder ) ) { 4567Debug.Assert( ps.chars[ps.charPos] == '&' ); 4571ps.charPos = newPos - 1; 4595int pos = ps.charPos + startOffset; 4598char[] chars = ps.chars; 4618if (pos + 1 >= ps.charsUsed) { 4622Throw(pos, Res.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, ps.charsUsed, pos)); 4665colonOffset = pos - ps.charPos; 4670colonOffset = pos - ps.charPos; 4676else if ( pos == ps.charsUsed 4687chars = ps.chars; 4694colonPos = ( colonOffset == -1 ) ? -1 : ps.charPos + colonOffset; 4702int offset = pos - ps.charPos; 4704pos = ps.charPos + offset; 4722if ( ps.chars[endPos] != ';' ) { 4726string entityName = nameTable.Add( ps.chars, ps.charPos, endPos - ps.charPos ); 4727ps.charPos = endPos + 1; 4846Debug.Assert( ps.appendMode ); 4847int initialPos = ps.charPos; 4852ps.charPos = initialPos; 4857Encoding enc = ps.encoding; 4877if ( v1Compat && pos == ps.charsUsed - 1 && ps.chars[pos] == (char)0 && await ReadDataAsync().ConfigureAwait(false) == 0 && ps.isStreamEof ) { 4878ps.charsUsed--; 4995curNode.AdjustLineInfo( readValueOffset, ps.eolNormalized, ref incReadLineInfo ); 5016incReadLineInfo.Set( ps.LineNo, ps.LinePos ); 5026charsRead = incReadDecoder.Decode( ps.chars, startPos, endPos - startPos ); 5038curNode.SetValue( ps.chars, startPos, endPos - startPos ); 5040AdjustLineInfo( ps.chars, startPos - charsRead, startPos, ps.eolNormalized, ref incReadLineInfo );