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

◆ ParseElement()

void System.Xml.XmlTextReaderImpl.ParseElement ( )
inlineprivate

Definition at line 4245 of file XmlTextReaderImpl.cs.

4246 {
4247 int num = _ps.charPos;
4248 char[] chars = _ps.chars;
4249 int colonPos = -1;
4251 while (true)
4252 {
4253 if (XmlCharType.IsStartNCNameSingleChar(chars[num]))
4254 {
4255 num++;
4256 while (true)
4257 {
4258 if (XmlCharType.IsNCNameSingleChar(chars[num]))
4259 {
4260 num++;
4261 continue;
4262 }
4263 if (chars[num] != ':')
4264 {
4265 break;
4266 }
4267 if (colonPos == -1)
4268 {
4269 goto IL_0088;
4270 }
4271 if (!_supportNamespaces)
4272 {
4273 num++;
4274 continue;
4275 }
4276 goto IL_006c;
4277 }
4278 if (num + 1 < _ps.charsUsed)
4279 {
4280 break;
4281 }
4282 }
4283 goto IL_00a0;
4284 IL_0088:
4285 colonPos = num;
4286 num++;
4287 continue;
4288 IL_00a0:
4289 num = ParseQName(out colonPos);
4290 chars = _ps.chars;
4291 break;
4292 IL_006c:
4293 Throw(num, System.SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(':', '\0'));
4294 goto IL_00a0;
4295 }
4297 if (colonPos == -1 || !_supportNamespaces)
4298 {
4299 _curNode.SetNamedNode(XmlNodeType.Element, _nameTable.Add(chars, _ps.charPos, num - _ps.charPos));
4300 }
4301 else
4302 {
4303 int charPos = _ps.charPos;
4304 int num2 = colonPos - charPos;
4305 if (num2 == _lastPrefix.Length && XmlConvert.StrEqual(chars, charPos, num2, _lastPrefix))
4306 {
4307 _curNode.SetNamedNode(XmlNodeType.Element, _nameTable.Add(chars, colonPos + 1, num - colonPos - 1), _lastPrefix, null);
4308 }
4309 else
4310 {
4311 _curNode.SetNamedNode(XmlNodeType.Element, _nameTable.Add(chars, colonPos + 1, num - colonPos - 1), _nameTable.Add(chars, _ps.charPos, num2), null);
4313 }
4314 }
4315 char c = chars[num];
4316 if (XmlCharType.IsWhiteSpace(c))
4317 {
4318 _ps.charPos = num;
4320 return;
4321 }
4322 switch (c)
4323 {
4324 case '>':
4325 _ps.charPos = num + 1;
4326 _parsingFunction = ParsingFunction.MoveToElementContent;
4327 break;
4328 case '/':
4329 if (num + 1 == _ps.charsUsed)
4330 {
4331 _ps.charPos = num;
4332 if (ReadData() == 0)
4333 {
4334 Throw(num, System.SR.Xml_UnexpectedEOF, ">");
4335 }
4336 num = _ps.charPos;
4337 chars = _ps.chars;
4338 }
4339 if (chars[num + 1] == '>')
4340 {
4343 _parsingFunction = ParsingFunction.PopEmptyElementContext;
4344 _ps.charPos = num + 2;
4345 }
4346 else
4347 {
4348 ThrowUnexpectedToken(num, ">");
4349 }
4350 break;
4351 default:
4352 Throw(num, System.SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, num));
4353 break;
4354 }
4356 {
4358 }
4360 }
static string Xml_BadNameChar
Definition SR.cs:44
static string Xml_UnexpectedEOF
Definition SR.cs:36
Definition SR.cs:7
string Add(char[] array, int offset, int length)
void SetLineInfo(int lineNo, int linePos)
void SetNamedNode(XmlNodeType type, string localName)
XmlNamespaceManager _namespaceManager
void Throw(int pos, string res, string arg)
void ThrowUnexpectedToken(int pos, string expectedToken)
int ParseQName(out int colonPos)

References System.Xml.XmlTextReaderImpl._addDefaultAttributesAndNormalize, System.Xml.XmlTextReaderImpl._curNode, System.Xml.XmlTextReaderImpl._lastPrefix, System.Xml.XmlTextReaderImpl._namespaceManager, System.Xml.XmlTextReaderImpl._nameTable, System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._supportNamespaces, System.Xml.XmlNameTable.Add(), System.Xml.XmlTextReaderImpl.AddDefaultAttributesAndNormalize(), System.Xml.XmlException.BuildCharExceptionArgs(), System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.ElementNamespaceLookup(), System.Xml.XmlCharType.IsNCNameSingleChar(), System.Xml.XmlCharType.IsStartNCNameSingleChar(), System.Xml.XmlCharType.IsWhiteSpace(), System.Xml.XmlTextReaderImpl.ParsingState.LineNo, System.Xml.XmlTextReaderImpl.ParsingState.LinePos, System.Xml.XmlTextReaderImpl.ParseAttributes(), System.Xml.XmlTextReaderImpl.ParseQName(), System.Xml.XmlTextReaderImpl.NodeData.prefix, System.Xml.XmlNamespaceManager.PushScope(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.NodeData.SetLineInfo(), System.Xml.XmlTextReaderImpl.NodeData.SetNamedNode(), System.Xml.XmlConvert.StrEqual(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(), System.SR.Xml_BadNameChar, and System.SR.Xml_UnexpectedEOF.

Referenced by System.Xml.XmlTextReaderImpl.ParseDocumentContent(), and System.Xml.XmlTextReaderImpl.ParseElementContent().