Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ParseAttributeValueSlow()

void System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow ( int curPos,
char quoteChar,
NodeData attr )
inlineprivate

Definition at line 4881 of file XmlTextReaderImpl.cs.

4882 {
4883 int charRefEndPos = curPos;
4884 char[] chars = _ps.chars;
4885 int entityId = _ps.entityId;
4886 int num = 0;
4887 LineInfo lineInfo = new LineInfo(_ps.lineNo, _ps.LinePos);
4888 NodeData lastChunk = null;
4889 while (true)
4890 {
4891 if (XmlCharType.IsAttributeValueChar(chars[charRefEndPos]))
4892 {
4893 charRefEndPos++;
4894 continue;
4895 }
4896 if (charRefEndPos - _ps.charPos > 0)
4897 {
4900 }
4901 if (chars[charRefEndPos] == quoteChar && entityId == _ps.entityId)
4902 {
4903 break;
4904 }
4905 switch (chars[charRefEndPos])
4906 {
4907 case '\n':
4908 charRefEndPos++;
4910 if (_normalize)
4911 {
4913 _ps.charPos++;
4914 }
4915 continue;
4916 case '\r':
4917 if (chars[charRefEndPos + 1] == '\n')
4918 {
4919 charRefEndPos += 2;
4920 if (_normalize)
4921 {
4924 }
4925 }
4926 else
4927 {
4928 if (charRefEndPos + 1 >= _ps.charsUsed && !_ps.isEof)
4929 {
4930 break;
4931 }
4932 charRefEndPos++;
4933 if (_normalize)
4934 {
4937 }
4938 }
4940 continue;
4941 case '\t':
4942 charRefEndPos++;
4943 if (_normalize)
4944 {
4946 _ps.charPos++;
4947 }
4948 continue;
4949 case '"':
4950 case '\'':
4951 case '>':
4952 charRefEndPos++;
4953 continue;
4954 case '<':
4955 Throw(charRefEndPos, System.SR.Xml_BadAttributeChar, XmlException.BuildCharExceptionArgs('<', '\0'));
4956 break;
4957 case '&':
4958 {
4959 if (charRefEndPos - _ps.charPos > 0)
4960 {
4962 }
4964 int entityId2 = _ps.entityId;
4965 LineInfo lineInfo2 = new LineInfo(_ps.lineNo, _ps.LinePos + 1);
4967 {
4968 case EntityType.Unexpanded:
4969 if (_parsingMode == ParsingMode.Full && _ps.entityId == entityId)
4970 {
4971 int num3 = _stringBuilder.Length - num;
4972 if (num3 > 0)
4973 {
4974 NodeData nodeData3 = new NodeData();
4975 nodeData3.lineInfo = lineInfo;
4977 nodeData3.SetValueNode(XmlNodeType.Text, _stringBuilder.ToString(num, num3));
4979 }
4980 _ps.charPos++;
4981 string text = ParseEntityName();
4982 NodeData nodeData4 = new NodeData();
4983 nodeData4.lineInfo = lineInfo2;
4985 nodeData4.SetNamedNode(XmlNodeType.EntityReference, text);
4990 num = _stringBuilder.Length;
4991 lineInfo.Set(_ps.LineNo, _ps.LinePos);
4992 _fullAttrCleanup = true;
4993 }
4994 else
4995 {
4996 _ps.charPos++;
4998 }
5000 break;
5001 case EntityType.ExpandedInAttribute:
5002 if (_parsingMode == ParsingMode.Full && entityId2 == entityId)
5003 {
5004 int num2 = _stringBuilder.Length - num;
5005 if (num2 > 0)
5006 {
5007 NodeData nodeData = new NodeData();
5008 nodeData.lineInfo = lineInfo;
5010 nodeData.SetValueNode(XmlNodeType.Text, _stringBuilder.ToString(num, num2));
5012 }
5013 NodeData nodeData2 = new NodeData();
5014 nodeData2.lineInfo = lineInfo2;
5016 nodeData2.SetNamedNode(XmlNodeType.EntityReference, _ps.entity.Name);
5018 _fullAttrCleanup = true;
5019 }
5021 break;
5022 default:
5024 break;
5025 case EntityType.CharacterDec:
5026 case EntityType.CharacterHex:
5027 case EntityType.CharacterNamed:
5028 break;
5029 }
5030 chars = _ps.chars;
5031 continue;
5032 }
5033 default:
5034 {
5036 {
5037 break;
5038 }
5039 char ch = chars[charRefEndPos];
5040 if (XmlCharType.IsHighSurrogate(ch))
5041 {
5042 if (charRefEndPos + 1 == _ps.charsUsed)
5043 {
5044 break;
5045 }
5046 charRefEndPos++;
5047 if (XmlCharType.IsLowSurrogate(chars[charRefEndPos]))
5048 {
5049 charRefEndPos++;
5050 continue;
5051 }
5052 }
5054 break;
5055 }
5056 }
5057 if (ReadData() == 0)
5058 {
5059 if (_ps.charsUsed - _ps.charPos > 0)
5060 {
5061 if (_ps.chars[_ps.charPos] != '\r')
5062 {
5064 }
5065 }
5066 else
5067 {
5068 if (!InEntity)
5069 {
5070 if (_fragmentType == XmlNodeType.Attribute)
5071 {
5072 if (entityId != _ps.entityId)
5073 {
5075 }
5076 break;
5077 }
5079 }
5081 {
5083 }
5084 if (entityId == _ps.entityId)
5085 {
5086 num = _stringBuilder.Length;
5087 lineInfo.Set(_ps.LineNo, _ps.LinePos);
5088 }
5089 }
5090 }
5092 chars = _ps.chars;
5093 }
5094 if (attr.nextAttrValueChunk != null)
5095 {
5096 int num4 = _stringBuilder.Length - num;
5097 if (num4 > 0)
5098 {
5099 NodeData nodeData5 = new NodeData();
5100 nodeData5.lineInfo = lineInfo;
5102 nodeData5.SetValueNode(XmlNodeType.Text, _stringBuilder.ToString(num, num4));
5104 }
5105 }
5107 attr.SetValue(_stringBuilder.ToString());
5109 }
static string Xml_BadAttributeChar
Definition SR.cs:74
static string Xml_UnexpectedEOF1
Definition SR.cs:38
static string Xml_UnclosedQuote
Definition SR.cs:34
static string Xml_EntityRefNesting
Definition SR.cs:140
static string Xml_InternalError
Definition SR.cs:54
Definition SR.cs:7
override string ToString()
StringBuilder Append(char value, int repeatCount)
void ThrowInvalidChar(char[] data, int length, int invCharPos)
readonly StringBuilder _stringBuilder
void AddAttributeChunkToList(NodeData attr, NodeData chunk, ref NodeData lastChunk)
EntityType HandleEntityReference(bool isInAttributeValue, EntityExpandType expandType, out int charRefEndPos)
bool HandleEntityEnd(bool checkEntityNesting)
void Throw(int pos, string res, string arg)

References System.Xml.XmlTextReaderImpl._fragmentType, System.Xml.XmlTextReaderImpl._fullAttrCleanup, System.Xml.XmlTextReaderImpl._normalize, System.Xml.XmlTextReaderImpl._parsingMode, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._stringBuilder, System.Xml.XmlTextReaderImpl.AddAttributeChunkToList(), System.Text.StringBuilder.Append(), System.Xml.XmlException.BuildCharExceptionArgs(), System.ch, System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.ParsingState.entity, System.Xml.XmlTextReaderImpl.ParsingState.entityId, System.Xml.XmlTextReaderImpl.ParsingState.eolNormalized, System.Xml.XmlTextReaderImpl.HandleEntityEnd(), System.Xml.XmlTextReaderImpl.HandleEntityReference(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlTextReaderImpl.ParsingState.isEof, System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Text.StringBuilder.Length, System.Xml.XmlTextReaderImpl.ParsingState.lineNo, System.Xml.XmlTextReaderImpl.ParsingState.LineNo, System.Xml.XmlTextReaderImpl.ParsingState.LinePos, System.Xml.IDtdEntityInfo.Name, System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.ParseEntityName(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.LineInfo.Set(), System.text, System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowInvalidChar(), System.Text.StringBuilder.ToString(), System.SR.Xml_BadAttributeChar, System.SR.Xml_EntityRefNesting, System.SR.Xml_InternalError, System.SR.Xml_UnclosedQuote, and System.SR.Xml_UnexpectedEOF1.

Referenced by System.Xml.XmlTextReaderImpl.ParseAttributes(), and System.Xml.XmlTextReaderImpl.ParseFragmentAttribute().