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

◆ ParseAttributes()

void System.Xml.XmlTextReaderImpl.ParseAttributes ( )
inlineprivate

Definition at line 4531 of file XmlTextReaderImpl.cs.

4532 {
4533 int num = _ps.charPos;
4534 char[] chars = _ps.chars;
4535 NodeData nodeData = null;
4536 while (true)
4537 {
4538 int num2 = 0;
4539 while (true)
4540 {
4541 char c;
4542 int num3;
4543 if (XmlCharType.IsWhiteSpace(c = chars[num]))
4544 {
4545 switch (c)
4546 {
4547 case '\n':
4548 OnNewLine(num + 1);
4549 num2++;
4550 goto IL_0085;
4551 case '\r':
4552 if (chars[num + 1] == '\n')
4553 {
4554 OnNewLine(num + 2);
4555 num2++;
4556 num++;
4557 goto IL_0085;
4558 }
4559 if (num + 1 != _ps.charsUsed)
4560 {
4561 OnNewLine(num + 1);
4562 num2++;
4563 goto IL_0085;
4564 }
4565 break;
4566 default:
4567 goto IL_0085;
4568 }
4569 _ps.charPos = num;
4570 }
4571 else
4572 {
4573 num3 = 0;
4574 char c2;
4575 if (XmlCharType.IsStartNCNameSingleChar(c2 = chars[num]))
4576 {
4577 num3 = 1;
4578 }
4579 if (num3 != 0)
4580 {
4581 goto IL_0171;
4582 }
4583 if (c2 == '>')
4584 {
4585 _ps.charPos = num + 1;
4586 _parsingFunction = ParsingFunction.MoveToElementContent;
4587 goto IL_0438;
4588 }
4589 if (c2 == '/')
4590 {
4591 if (num + 1 != _ps.charsUsed)
4592 {
4593 if (chars[num + 1] == '>')
4594 {
4595 _ps.charPos = num + 2;
4598 _parsingFunction = ParsingFunction.PopEmptyElementContext;
4599 goto IL_0438;
4600 }
4601 ThrowUnexpectedToken(num + 1, ">");
4602 goto IL_0171;
4603 }
4604 }
4605 else if (num != _ps.charsUsed)
4606 {
4607 if (c2 != ':' || _supportNamespaces)
4608 {
4609 Throw(num, System.SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, num));
4610 }
4611 goto IL_0171;
4612 }
4613 }
4614 _ps.lineNo -= num2;
4615 if (ReadData() != 0)
4616 {
4617 num = _ps.charPos;
4618 chars = _ps.chars;
4619 }
4620 else
4621 {
4623 }
4624 break;
4625 IL_0438:
4627 {
4629 }
4632 {
4635 }
4636 if (_attrDuplWalkCount >= 250)
4637 {
4639 }
4640 return;
4641 IL_0085:
4642 num++;
4643 continue;
4644 IL_0171:
4645 if (num == _ps.charPos)
4646 {
4648 }
4649 _ps.charPos = num;
4650 int linePos = _ps.LinePos;
4651 int colonPos = -1;
4652 num += num3;
4653 while (true)
4654 {
4655 char c3;
4656 if (XmlCharType.IsNCNameSingleChar(c3 = chars[num]))
4657 {
4658 num++;
4659 continue;
4660 }
4661 if (c3 == ':')
4662 {
4663 if (colonPos != -1)
4664 {
4666 {
4667 Throw(num, System.SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(':', '\0'));
4668 break;
4669 }
4670 num++;
4671 continue;
4672 }
4673 colonPos = num;
4674 num++;
4675 if (XmlCharType.IsStartNCNameSingleChar(chars[num]))
4676 {
4677 num++;
4678 continue;
4679 }
4680 num = ParseQName(out colonPos);
4681 chars = _ps.chars;
4682 break;
4683 }
4684 if (num + 1 >= _ps.charsUsed)
4685 {
4686 num = ParseQName(out colonPos);
4687 chars = _ps.chars;
4688 }
4689 break;
4690 }
4692 nodeData.SetLineInfo(_ps.LineNo, linePos);
4693 if (chars[num] != '=')
4694 {
4695 _ps.charPos = num;
4696 EatWhitespaces(null);
4697 num = _ps.charPos;
4698 if (chars[num] != '=')
4699 {
4701 }
4702 }
4703 num++;
4704 char c4 = chars[num];
4705 if (c4 != '"' && c4 != '\'')
4706 {
4707 _ps.charPos = num;
4708 EatWhitespaces(null);
4709 num = _ps.charPos;
4710 c4 = chars[num];
4711 if (c4 != '"' && c4 != '\'')
4712 {
4713 ThrowUnexpectedToken("\"", "'");
4714 }
4715 }
4716 num++;
4717 _ps.charPos = num;
4719 nodeData.SetLineInfo2(_ps.LineNo, _ps.LinePos);
4720 char c5;
4721 while (XmlCharType.IsAttributeValueChar(c5 = chars[num]))
4722 {
4723 num++;
4724 }
4725 if (c5 == c4)
4726 {
4727 nodeData.SetValue(chars, _ps.charPos, num - _ps.charPos);
4728 num++;
4729 _ps.charPos = num;
4730 }
4731 else
4732 {
4734 num = _ps.charPos;
4735 chars = _ps.chars;
4736 }
4737 if (nodeData.prefix.Length == 0)
4738 {
4739 if (Ref.Equal(nodeData.localName, _xmlNs))
4740 {
4742 }
4743 }
4744 else if (Ref.Equal(nodeData.prefix, _xmlNs))
4745 {
4747 }
4748 else if (Ref.Equal(nodeData.prefix, _xml))
4749 {
4751 }
4752 break;
4753 }
4754 }
4755 }
static string Xml_BadStartNameChar
Definition SR.cs:42
static string Xml_BadNameChar
Definition SR.cs:44
Definition SR.cs:7
void OnXmlReservedAttribute(NodeData attr)
void OnDefaultNamespaceDecl(NodeData attr)
void OnNamespaceDecl(NodeData attr)
NodeData AddAttribute(int endNamePos, int colonPos)
void ParseAttributeValueSlow(int curPos, char quoteChar, NodeData attr)
int EatWhitespaces(StringBuilder sb)
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._attrDuplWalkCount, System.Xml.XmlTextReaderImpl._attrNeedNamespaceLookup, System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._supportNamespaces, System.Xml.XmlTextReaderImpl._xml, System.Xml.XmlTextReaderImpl._xmlNs, System.Xml.XmlTextReaderImpl.AddAttribute(), System.Xml.XmlTextReaderImpl.AddDefaultAttributesAndNormalize(), System.Xml.XmlTextReaderImpl.AttributeDuplCheck(), System.Xml.XmlTextReaderImpl.AttributeNamespaceLookup(), 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.EatWhitespaces(), System.Xml.XmlTextReaderImpl.ElementNamespaceLookup(), System.Xml.Ref.Equal(), System.Xml.XmlCharType.IsAttributeValueChar(), 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.OnDefaultNamespaceDecl(), System.Xml.XmlTextReaderImpl.OnNamespaceDecl(), System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.OnXmlReservedAttribute(), System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(), System.Xml.XmlTextReaderImpl.ParseQName(), System.Xml.XmlTextReaderImpl.ReadData(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowExpectingWhitespace(), System.Xml.XmlTextReaderImpl.ThrowUnclosedElements(), System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(), System.SR.Xml_BadNameChar, and System.SR.Xml_BadStartNameChar.

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