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

◆ ParseDocumentContent()

bool System.Xml.XmlTextReaderImpl.ParseDocumentContent ( )
inlineprivate

Definition at line 3901 of file XmlTextReaderImpl.cs.

3902 {
3903 bool flag = false;
3904 while (true)
3905 {
3906 bool flag2 = false;
3907 int charPos = _ps.charPos;
3908 char[] chars = _ps.chars;
3909 if (chars[charPos] == '<')
3910 {
3911 flag2 = true;
3912 if (_ps.charsUsed - charPos >= 4)
3913 {
3914 charPos++;
3915 switch (chars[charPos])
3916 {
3917 case '?':
3918 _ps.charPos = charPos + 1;
3919 if (!ParsePI())
3920 {
3921 continue;
3922 }
3923 return true;
3924 case '!':
3925 charPos++;
3926 if (_ps.charsUsed - charPos < 2)
3927 {
3928 break;
3929 }
3930 if (chars[charPos] == '-')
3931 {
3932 if (chars[charPos + 1] == '-')
3933 {
3934 _ps.charPos = charPos + 2;
3935 if (!ParseComment())
3936 {
3937 continue;
3938 }
3939 return true;
3940 }
3941 ThrowUnexpectedToken(charPos + 1, "-");
3942 break;
3943 }
3944 if (chars[charPos] == '[')
3945 {
3946 if (_fragmentType != XmlNodeType.Document)
3947 {
3948 charPos++;
3949 if (_ps.charsUsed - charPos < 6)
3950 {
3951 break;
3952 }
3953 if (XmlConvert.StrEqual(chars, charPos, 6, "CDATA["))
3954 {
3955 _ps.charPos = charPos + 6;
3956 ParseCData();
3957 if (_fragmentType == XmlNodeType.None)
3958 {
3959 _fragmentType = XmlNodeType.Element;
3960 }
3961 return true;
3962 }
3963 ThrowUnexpectedToken(charPos, "CDATA[");
3964 }
3965 else
3966 {
3968 }
3969 break;
3970 }
3971 if (_fragmentType == XmlNodeType.Document || _fragmentType == XmlNodeType.None)
3972 {
3973 _fragmentType = XmlNodeType.Document;
3974 _ps.charPos = charPos;
3975 if (!ParseDoctypeDecl())
3976 {
3977 continue;
3978 }
3979 return true;
3980 }
3981 if (ParseUnexpectedToken(charPos) == "DOCTYPE")
3982 {
3984 }
3985 else
3986 {
3987 ThrowUnexpectedToken(charPos, "<!--", "<[CDATA[");
3988 }
3989 break;
3990 case '/':
3991 Throw(charPos + 1, System.SR.Xml_UnexpectedEndTag);
3992 break;
3993 default:
3995 {
3996 if (_fragmentType == XmlNodeType.Document)
3997 {
3998 Throw(charPos, System.SR.Xml_MultipleRoots);
3999 }
4000 if (_fragmentType == XmlNodeType.None)
4001 {
4002 _fragmentType = XmlNodeType.Element;
4003 }
4004 }
4005 _ps.charPos = charPos;
4006 _rootElementParsed = true;
4007 ParseElement();
4008 return true;
4009 }
4010 }
4011 }
4012 else if (chars[charPos] == '&')
4013 {
4014 if (_fragmentType != XmlNodeType.Document)
4015 {
4016 if (_fragmentType == XmlNodeType.None)
4017 {
4018 _fragmentType = XmlNodeType.Element;
4019 }
4020 int charRefEndPos;
4022 {
4023 case EntityType.Unexpanded:
4024 if (_parsingFunction == ParsingFunction.EntityReference)
4025 {
4027 }
4029 return true;
4030 case EntityType.CharacterDec:
4031 case EntityType.CharacterHex:
4032 case EntityType.CharacterNamed:
4033 if (ParseText())
4034 {
4035 return true;
4036 }
4037 break;
4038 default:
4039 chars = _ps.chars;
4040 charPos = _ps.charPos;
4041 break;
4042 }
4043 continue;
4044 }
4046 }
4047 else if (charPos != _ps.charsUsed && (!(_v1Compat || flag) || chars[charPos] != 0))
4048 {
4049 if (_fragmentType == XmlNodeType.Document)
4050 {
4052 {
4053 return true;
4054 }
4055 }
4056 else if (ParseText())
4057 {
4058 if (_fragmentType == XmlNodeType.None && _curNode.type == XmlNodeType.Text)
4059 {
4060 _fragmentType = XmlNodeType.Element;
4061 }
4062 return true;
4063 }
4064 continue;
4065 }
4066 if (ReadData() != 0)
4067 {
4068 charPos = _ps.charPos;
4069 charPos = _ps.charPos;
4070 chars = _ps.chars;
4071 continue;
4072 }
4073 if (flag2)
4074 {
4076 }
4077 if (!InEntity)
4078 {
4079 break;
4080 }
4082 {
4084 return true;
4085 }
4086 }
4087 if (!_rootElementParsed && _fragmentType == XmlNodeType.Document)
4088 {
4090 }
4091 if (_fragmentType == XmlNodeType.None)
4092 {
4093 _fragmentType = ((!_rootElementParsed) ? XmlNodeType.Element : XmlNodeType.Document);
4094 }
4095 OnEof();
4096 return false;
4097 }
static string Xml_BadDTDLocation
Definition SR.cs:98
static string Xml_MissingRoot
Definition SR.cs:78
static string Xml_MultipleRoots
Definition SR.cs:80
static string Xml_InvalidRootData
Definition SR.cs:82
static string Xml_UnexpectedEndTag
Definition SR.cs:70
Definition SR.cs:7
EntityType HandleEntityReference(bool isInAttributeValue, EntityExpandType expandType, out int charRefEndPos)
bool HandleEntityEnd(bool checkEntityNesting)
void Throw(int pos, string res, string arg)
void ThrowUnexpectedToken(int pos, string expectedToken)

References System.Xml.XmlTextReaderImpl._curNode, System.Xml.XmlTextReaderImpl._fragmentType, System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._rootElementParsed, System.Xml.XmlTextReaderImpl._v1Compat, 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.XmlTextReaderImpl.OnEof(), System.Xml.XmlTextReaderImpl.ParseCData(), System.Xml.XmlTextReaderImpl.ParseComment(), System.Xml.XmlTextReaderImpl.ParseDoctypeDecl(), System.Xml.XmlTextReaderImpl.ParseElement(), System.Xml.XmlTextReaderImpl.ParseEntityReference(), System.Xml.XmlTextReaderImpl.ParsePI(), System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace(), System.Xml.XmlTextReaderImpl.ParseText(), System.Xml.XmlTextReaderImpl.ParseUnexpectedToken(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.SetupEndEntityNodeInContent(), System.Xml.XmlConvert.StrEqual(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(), System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo(), System.Xml.XmlTextReaderImpl.NodeData.type, System.SR.Xml_BadDTDLocation, System.SR.Xml_InvalidRootData, System.SR.Xml_MissingRoot, System.SR.Xml_MultipleRoots, and System.SR.Xml_UnexpectedEndTag.

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