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

◆ ParseAttributeValueChunk()

bool System.Xml.XmlTextReaderImpl.ParseAttributeValueChunk ( )
inlineprivate

Definition at line 7719 of file XmlTextReaderImpl.cs.

7720 {
7721 char[] chars = _ps.chars;
7723 _curNode = AddNode(_index + _attrCount + 1, _index + 2);
7726 {
7727 _curNode.SetValueNode(XmlNodeType.Text, string.Empty);
7729 return true;
7730 }
7731 while (true)
7732 {
7733 if (XmlCharType.IsAttributeValueChar(chars[charRefEndPos]))
7734 {
7735 charRefEndPos++;
7736 continue;
7737 }
7738 switch (chars[charRefEndPos])
7739 {
7740 case '\r':
7741 charRefEndPos++;
7742 continue;
7743 case '\t':
7744 case '\n':
7745 if (_normalize)
7746 {
7747 chars[charRefEndPos] = ' ';
7748 }
7749 charRefEndPos++;
7750 continue;
7751 case '"':
7752 case '\'':
7753 case '>':
7754 charRefEndPos++;
7755 continue;
7756 case '<':
7757 Throw(charRefEndPos, System.SR.Xml_BadAttributeChar, XmlException.BuildCharExceptionArgs('<', '\0'));
7758 goto IL_025f;
7759 case '&':
7760 {
7761 if (charRefEndPos - _ps.charPos > 0)
7762 {
7764 }
7767 if ((uint)entityType > 2u)
7768 {
7769 if (entityType == EntityType.Unexpanded)
7770 {
7771 if (_stringBuilder.Length == 0)
7772 {
7774 _ps.charPos++;
7775 _curNode.SetNamedNode(XmlNodeType.EntityReference, ParseEntityName());
7776 return true;
7777 }
7778 break;
7779 }
7780 }
7781 else
7782 {
7783 chars = _ps.chars;
7784 if (_normalize && XmlCharType.IsWhiteSpace(chars[_ps.charPos]) && charRefEndPos - _ps.charPos == 1)
7785 {
7786 chars[_ps.charPos] = ' ';
7787 }
7788 }
7789 chars = _ps.chars;
7790 continue;
7791 }
7792 default:
7793 {
7795 {
7796 char ch = chars[charRefEndPos];
7797 if (XmlCharType.IsHighSurrogate(ch))
7798 {
7799 if (charRefEndPos + 1 == _ps.charsUsed)
7800 {
7801 goto IL_025f;
7802 }
7803 charRefEndPos++;
7804 if (XmlCharType.IsLowSurrogate(chars[charRefEndPos]))
7805 {
7806 charRefEndPos++;
7807 continue;
7808 }
7809 }
7811 }
7812 goto IL_025f;
7813 }
7814 IL_025f:
7815 if (charRefEndPos - _ps.charPos > 0)
7816 {
7819 }
7820 if (ReadData() == 0)
7821 {
7822 if (_stringBuilder.Length > 0)
7823 {
7824 break;
7825 }
7827 {
7829 return true;
7830 }
7831 }
7833 chars = _ps.chars;
7834 continue;
7835 }
7836 break;
7837 }
7838 if (charRefEndPos - _ps.charPos > 0)
7839 {
7842 }
7843 _curNode.SetValueNode(XmlNodeType.Text, _stringBuilder.ToString());
7845 return true;
7846 }
static string Xml_BadAttributeChar
Definition SR.cs:74
Definition SR.cs:7
override string ToString()
StringBuilder Append(char value, int repeatCount)
void SetLineInfo(int lineNo, int linePos)
void SetNamedNode(XmlNodeType type, string localName)
void SetValueNode(XmlNodeType type, string value)
void ThrowInvalidChar(char[] data, int length, int invCharPos)
readonly StringBuilder _stringBuilder
EntityType HandleEntityReference(bool isInAttributeValue, EntityExpandType expandType, out int charRefEndPos)
bool HandleEntityEnd(bool checkEntityNesting)
NodeData AddNode(int nodeIndex, int nodeDepth)
void Throw(int pos, string res, string arg)

References System.Xml.XmlTextReaderImpl._attrCount, System.Xml.XmlTextReaderImpl._curNode, System.Xml.XmlTextReaderImpl._emptyEntityInAttributeResolved, System.Xml.XmlTextReaderImpl._index, System.Xml.XmlTextReaderImpl._normalize, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._stringBuilder, System.Xml.XmlTextReaderImpl.AddNode(), 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.HandleEntityEnd(), System.Xml.XmlTextReaderImpl.HandleEntityReference(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Xml.XmlCharType.IsWhiteSpace(), System.Text.StringBuilder.Length, System.Xml.XmlTextReaderImpl.NodeData.lineInfo, System.Xml.XmlTextReaderImpl.ParsingState.LineNo, System.Xml.LineInfo.linePos, System.Xml.XmlTextReaderImpl.ParsingState.LinePos, System.Xml.XmlTextReaderImpl.ParseEntityName(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.NodeData.SetLineInfo(), System.Xml.XmlTextReaderImpl.NodeData.SetNamedNode(), System.Xml.XmlTextReaderImpl.SetupEndEntityNodeInAttribute(), System.Xml.XmlTextReaderImpl.NodeData.SetValueNode(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowInvalidChar(), System.Text.StringBuilder.ToString(), and System.SR.Xml_BadAttributeChar.

Referenced by System.Xml.XmlTextReaderImpl.ReadAttributeValue().