Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlReader.cs
Go to the documentation of this file.
4using System.IO;
5using System.Text;
8
9namespace System.Xml;
10
11[DebuggerDisplay("{DebuggerDisplayProxy}")]
12[DebuggerDisplay("{DebuggerDisplayProxy}")]
13public abstract class XmlReader : IDisposable
14{
15 [DebuggerDisplay("{ToString()}")]
16 private readonly struct XmlReaderDebuggerDisplayProxy
17 {
18 private readonly XmlReader _reader;
19
21 {
22 _reader = reader;
23 }
24
25 public override string ToString()
26 {
27 XmlNodeType nodeType = _reader.NodeType;
28 string text = nodeType.ToString();
29 switch (nodeType)
30 {
31 case XmlNodeType.Element:
32 case XmlNodeType.EntityReference:
33 case XmlNodeType.EndElement:
34 case XmlNodeType.EndEntity:
35 text = text + ", Name=\"" + _reader.Name + "\"";
36 break;
37 case XmlNodeType.Attribute:
38 case XmlNodeType.ProcessingInstruction:
39 text = text + ", Name=\"" + _reader.Name + "\", Value=\"" + XmlConvert.EscapeValueForDebuggerDisplay(_reader.Value) + "\"";
40 break;
41 case XmlNodeType.Text:
42 case XmlNodeType.CDATA:
43 case XmlNodeType.Comment:
44 case XmlNodeType.Whitespace:
45 case XmlNodeType.SignificantWhitespace:
46 case XmlNodeType.XmlDeclaration:
48 break;
49 case XmlNodeType.DocumentType:
50 text = text + ", Name=\"" + _reader.Name + "'";
51 text = text + ", SYSTEM=\"" + _reader.GetAttribute("SYSTEM") + "\"";
52 text = text + ", PUBLIC=\"" + _reader.GetAttribute("PUBLIC") + "\"";
54 break;
55 }
56 return text;
57 }
58 }
59
60 public virtual XmlReaderSettings? Settings => null;
61
62 public abstract XmlNodeType NodeType { get; }
63
64 public virtual string Name
65 {
66 get
67 {
68 if (Prefix.Length != 0)
69 {
70 return NameTable.Add(Prefix + ":" + LocalName);
71 }
72 return LocalName;
73 }
74 }
75
76 public abstract string LocalName { get; }
77
78 public abstract string NamespaceURI { get; }
79
80 public abstract string Prefix { get; }
81
82 public virtual bool HasValue => HasValueInternal(NodeType);
83
84 public abstract string Value { get; }
85
86 public abstract int Depth { get; }
87
88 public abstract string BaseURI { get; }
89
90 public abstract bool IsEmptyElement { get; }
91
92 public virtual bool IsDefault => false;
93
94 public virtual char QuoteChar => '"';
95
96 public virtual XmlSpace XmlSpace => XmlSpace.None;
97
98 public virtual string XmlLang => string.Empty;
99
101
102 public virtual Type ValueType => typeof(string);
103
104 public abstract int AttributeCount { get; }
105
106 public virtual string this[int i] => GetAttribute(i);
107
108 public virtual string? this[string name] => GetAttribute(name);
109
110 public virtual string? this[string name, string? namespaceURI] => GetAttribute(name, namespaceURI);
111
112 public abstract bool EOF { get; }
113
114 public abstract ReadState ReadState { get; }
115
116 public abstract XmlNameTable NameTable { get; }
117
118 public virtual bool CanResolveEntity => false;
119
120 public virtual bool CanReadBinaryContent => false;
121
122 public virtual bool CanReadValueChunk => false;
123
124 public virtual bool HasAttributes => AttributeCount > 0;
125
126 internal virtual XmlNamespaceManager? NamespaceManager => null;
127
128 internal bool IsDefaultInternal
129 {
130 get
131 {
132 if (IsDefault)
133 {
134 return true;
135 }
136 IXmlSchemaInfo schemaInfo = SchemaInfo;
137 if (schemaInfo != null && schemaInfo.IsDefault)
138 {
139 return true;
140 }
141 return false;
142 }
143 }
144
145 internal virtual IDtdInfo? DtdInfo => null;
146
148
149 public virtual object ReadContentAsObject()
150 {
151 if (!CanReadContentAs())
152 {
153 throw CreateReadContentAsException("ReadContentAsObject");
154 }
156 }
157
158 public virtual bool ReadContentAsBoolean()
159 {
160 if (!CanReadContentAs())
161 {
162 throw CreateReadContentAsException("ReadContentAsBoolean");
163 }
164 try
165 {
167 }
169 {
171 }
172 }
173
175 {
176 if (!CanReadContentAs())
177 {
178 throw CreateReadContentAsException("ReadContentAsDateTime");
179 }
180 try
181 {
183 }
185 {
187 }
188 }
189
191 {
192 if (!CanReadContentAs())
193 {
194 throw CreateReadContentAsException("ReadContentAsDateTimeOffset");
195 }
196 try
197 {
199 }
201 {
203 }
204 }
205
206 public virtual double ReadContentAsDouble()
207 {
208 if (!CanReadContentAs())
209 {
210 throw CreateReadContentAsException("ReadContentAsDouble");
211 }
212 try
213 {
215 }
217 {
219 }
220 }
221
222 public virtual float ReadContentAsFloat()
223 {
224 if (!CanReadContentAs())
225 {
226 throw CreateReadContentAsException("ReadContentAsFloat");
227 }
228 try
229 {
231 }
233 {
235 }
236 }
237
238 public virtual decimal ReadContentAsDecimal()
239 {
240 if (!CanReadContentAs())
241 {
242 throw CreateReadContentAsException("ReadContentAsDecimal");
243 }
244 try
245 {
247 }
249 {
251 }
252 }
253
254 public virtual int ReadContentAsInt()
255 {
256 if (!CanReadContentAs())
257 {
258 throw CreateReadContentAsException("ReadContentAsInt");
259 }
260 try
261 {
263 }
265 {
267 }
268 }
269
270 public virtual long ReadContentAsLong()
271 {
272 if (!CanReadContentAs())
273 {
274 throw CreateReadContentAsException("ReadContentAsLong");
275 }
276 try
277 {
279 }
281 {
283 }
284 }
285
286 public virtual string ReadContentAsString()
287 {
288 if (!CanReadContentAs())
289 {
290 throw CreateReadContentAsException("ReadContentAsString");
291 }
293 }
294
296 {
297 if (!CanReadContentAs())
298 {
299 throw CreateReadContentAsException("ReadContentAs");
300 }
302 if (returnType == typeof(string))
303 {
304 return text;
305 }
306 try
307 {
309 }
311 {
313 }
315 {
317 }
318 }
319
320 public virtual object ReadElementContentAsObject()
321 {
322 if (SetupReadElementContentAsXxx("ReadElementContentAsObject"))
323 {
324 object result = ReadContentAsObject();
326 return result;
327 }
328 return string.Empty;
329 }
330
331 public virtual object ReadElementContentAsObject(string localName, string namespaceURI)
332 {
333 CheckElement(localName, namespaceURI);
335 }
336
337 public virtual bool ReadElementContentAsBoolean()
338 {
339 if (SetupReadElementContentAsXxx("ReadElementContentAsBoolean"))
340 {
341 bool result = ReadContentAsBoolean();
343 return result;
344 }
345 return XmlConvert.ToBoolean(string.Empty);
346 }
347
348 public virtual bool ReadElementContentAsBoolean(string localName, string namespaceURI)
349 {
350 CheckElement(localName, namespaceURI);
352 }
353
355 {
356 if (SetupReadElementContentAsXxx("ReadElementContentAsDateTime"))
357 {
360 return result;
361 }
362 return XmlConvert.ToDateTime(string.Empty, XmlDateTimeSerializationMode.RoundtripKind);
363 }
364
365 public virtual DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
366 {
367 CheckElement(localName, namespaceURI);
369 }
370
371 public virtual double ReadElementContentAsDouble()
372 {
373 if (SetupReadElementContentAsXxx("ReadElementContentAsDouble"))
374 {
375 double result = ReadContentAsDouble();
377 return result;
378 }
379 return XmlConvert.ToDouble(string.Empty);
380 }
381
382 public virtual double ReadElementContentAsDouble(string localName, string namespaceURI)
383 {
384 CheckElement(localName, namespaceURI);
386 }
387
388 public virtual float ReadElementContentAsFloat()
389 {
390 if (SetupReadElementContentAsXxx("ReadElementContentAsFloat"))
391 {
392 float result = ReadContentAsFloat();
394 return result;
395 }
396 return XmlConvert.ToSingle(string.Empty);
397 }
398
399 public virtual float ReadElementContentAsFloat(string localName, string namespaceURI)
400 {
401 CheckElement(localName, namespaceURI);
403 }
404
405 public virtual decimal ReadElementContentAsDecimal()
406 {
407 if (SetupReadElementContentAsXxx("ReadElementContentAsDecimal"))
408 {
409 decimal result = ReadContentAsDecimal();
411 return result;
412 }
413 return XmlConvert.ToDecimal(string.Empty);
414 }
415
416 public virtual decimal ReadElementContentAsDecimal(string localName, string namespaceURI)
417 {
418 CheckElement(localName, namespaceURI);
420 }
421
422 public virtual int ReadElementContentAsInt()
423 {
424 if (SetupReadElementContentAsXxx("ReadElementContentAsInt"))
425 {
426 int result = ReadContentAsInt();
428 return result;
429 }
430 return XmlConvert.ToInt32(string.Empty);
431 }
432
433 public virtual int ReadElementContentAsInt(string localName, string namespaceURI)
434 {
435 CheckElement(localName, namespaceURI);
437 }
438
439 public virtual long ReadElementContentAsLong()
440 {
441 if (SetupReadElementContentAsXxx("ReadElementContentAsLong"))
442 {
443 long result = ReadContentAsLong();
445 return result;
446 }
447 return XmlConvert.ToInt64(string.Empty);
448 }
449
450 public virtual long ReadElementContentAsLong(string localName, string namespaceURI)
451 {
452 CheckElement(localName, namespaceURI);
454 }
455
456 public virtual string ReadElementContentAsString()
457 {
458 if (SetupReadElementContentAsXxx("ReadElementContentAsString"))
459 {
460 string result = ReadContentAsString();
462 return result;
463 }
464 return string.Empty;
465 }
466
467 public virtual string ReadElementContentAsString(string localName, string namespaceURI)
468 {
469 CheckElement(localName, namespaceURI);
471 }
472
474 {
475 if (SetupReadElementContentAsXxx("ReadElementContentAs"))
476 {
479 return result;
480 }
481 if (!(returnType == typeof(string)))
482 {
484 }
485 return string.Empty;
486 }
487
493
494 public abstract string? GetAttribute(string name);
495
496 public abstract string? GetAttribute(string name, string? namespaceURI);
497
498 public abstract string GetAttribute(int i);
499
500 public abstract bool MoveToAttribute(string name);
501
502 public abstract bool MoveToAttribute(string name, string? ns);
503
504 public virtual void MoveToAttribute(int i)
505 {
507 {
508 throw new ArgumentOutOfRangeException("i");
509 }
512 for (int j = 0; j < i; j++)
513 {
515 }
516 }
517
518 public abstract bool MoveToFirstAttribute();
519
520 public abstract bool MoveToNextAttribute();
521
522 public abstract bool MoveToElement();
523
524 public abstract bool ReadAttributeValue();
525
526 public abstract bool Read();
527
528 public virtual void Close()
529 {
530 }
531
532 public virtual void Skip()
533 {
534 if (ReadState == ReadState.Interactive)
535 {
536 SkipSubtree();
537 }
538 }
539
540 public abstract string? LookupNamespace(string prefix);
541
542 public abstract void ResolveEntity();
543
544 public virtual int ReadContentAsBase64(byte[] buffer, int index, int count)
545 {
547 }
548
549 public virtual int ReadElementContentAsBase64(byte[] buffer, int index, int count)
550 {
551 throw new NotSupportedException(System.SR.Format(System.SR.Xml_ReadBinaryContentNotSupported, "ReadElementContentAsBase64"));
552 }
553
554 public virtual int ReadContentAsBinHex(byte[] buffer, int index, int count)
555 {
557 }
558
559 public virtual int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
560 {
561 throw new NotSupportedException(System.SR.Format(System.SR.Xml_ReadBinaryContentNotSupported, "ReadElementContentAsBinHex"));
562 }
563
564 public virtual int ReadValueChunk(char[] buffer, int index, int count)
565 {
567 }
568
570 public virtual string ReadString()
571 {
572 if (ReadState != ReadState.Interactive)
573 {
574 return string.Empty;
575 }
577 if (NodeType == XmlNodeType.Element)
578 {
579 if (IsEmptyElement)
580 {
581 return string.Empty;
582 }
583 if (!Read())
584 {
586 }
587 if (NodeType == XmlNodeType.EndElement)
588 {
589 return string.Empty;
590 }
591 }
592 string text = string.Empty;
593 while (IsTextualNode(NodeType))
594 {
595 text += Value;
596 if (!Read())
597 {
598 break;
599 }
600 }
601 return text;
602 }
603
604 public virtual XmlNodeType MoveToContent()
605 {
606 do
607 {
608 switch (NodeType)
609 {
610 case XmlNodeType.Attribute:
612 break;
613 case XmlNodeType.Element:
614 case XmlNodeType.Text:
615 case XmlNodeType.CDATA:
616 case XmlNodeType.EntityReference:
617 case XmlNodeType.EndElement:
618 case XmlNodeType.EndEntity:
619 break;
620 default:
621 continue;
622 }
623 return NodeType;
624 }
625 while (Read());
626 return NodeType;
627 }
628
629 public virtual void ReadStartElement()
630 {
631 if (MoveToContent() != XmlNodeType.Element)
632 {
633 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
634 }
635 Read();
636 }
637
638 public virtual void ReadStartElement(string name)
639 {
640 if (MoveToContent() != XmlNodeType.Element)
641 {
642 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
643 }
644 if (Name == name)
645 {
646 Read();
647 return;
648 }
650 }
651
652 public virtual void ReadStartElement(string localname, string ns)
653 {
654 if (MoveToContent() != XmlNodeType.Element)
655 {
656 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
657 }
658 if (LocalName == localname && NamespaceURI == ns)
659 {
660 Read();
661 return;
662 }
663 throw new XmlException(System.SR.Xml_ElementNotFoundNs, new string[2] { localname, ns }, this as IXmlLineInfo);
664 }
665
667 public virtual string ReadElementString()
668 {
669 string result = string.Empty;
670 if (MoveToContent() != XmlNodeType.Element)
671 {
672 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
673 }
674 if (!IsEmptyElement)
675 {
676 Read();
677 result = ReadString();
678 if (NodeType != XmlNodeType.EndElement)
679 {
681 {
682 NodeType.ToString(),
683 "ReadElementString"
684 }, this as IXmlLineInfo);
685 }
686 Read();
687 }
688 else
689 {
690 Read();
691 }
692 return result;
693 }
694
696 public virtual string ReadElementString(string name)
697 {
698 string result = string.Empty;
699 if (MoveToContent() != XmlNodeType.Element)
700 {
701 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
702 }
703 if (Name != name)
704 {
706 }
707 if (!IsEmptyElement)
708 {
709 result = ReadString();
710 if (NodeType != XmlNodeType.EndElement)
711 {
712 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
713 }
714 Read();
715 }
716 else
717 {
718 Read();
719 }
720 return result;
721 }
722
724 public virtual string ReadElementString(string localname, string ns)
725 {
726 string result = string.Empty;
727 if (MoveToContent() != XmlNodeType.Element)
728 {
729 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
730 }
731 if (LocalName != localname || NamespaceURI != ns)
732 {
733 throw new XmlException(System.SR.Xml_ElementNotFoundNs, new string[2] { localname, ns }, this as IXmlLineInfo);
734 }
735 if (!IsEmptyElement)
736 {
737 result = ReadString();
738 if (NodeType != XmlNodeType.EndElement)
739 {
740 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
741 }
742 Read();
743 }
744 else
745 {
746 Read();
747 }
748 return result;
749 }
750
751 public virtual void ReadEndElement()
752 {
753 if (MoveToContent() != XmlNodeType.EndElement)
754 {
755 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
756 }
757 Read();
758 }
759
760 public virtual bool IsStartElement()
761 {
762 return MoveToContent() == XmlNodeType.Element;
763 }
764
765 public virtual bool IsStartElement(string name)
766 {
767 if (MoveToContent() == XmlNodeType.Element)
768 {
769 return Name == name;
770 }
771 return false;
772 }
773
774 public virtual bool IsStartElement(string localname, string ns)
775 {
776 if (MoveToContent() == XmlNodeType.Element)
777 {
778 if (LocalName == localname)
779 {
780 return NamespaceURI == ns;
781 }
782 return false;
783 }
784 return false;
785 }
786
787 public virtual bool ReadToFollowing(string name)
788 {
789 if (name == null || name.Length == 0)
790 {
792 }
793 name = NameTable.Add(name);
794 while (Read())
795 {
796 if (NodeType == XmlNodeType.Element && Ref.Equal(name, Name))
797 {
798 return true;
799 }
800 }
801 return false;
802 }
803
804 public virtual bool ReadToFollowing(string localName, string namespaceURI)
805 {
806 if (localName == null || localName.Length == 0)
807 {
808 throw XmlConvert.CreateInvalidNameArgumentException(localName, "localName");
809 }
810 if (namespaceURI == null)
811 {
812 throw new ArgumentNullException("namespaceURI");
813 }
814 localName = NameTable.Add(localName);
816 while (Read())
817 {
818 if (NodeType == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
819 {
820 return true;
821 }
822 }
823 return false;
824 }
825
826 public virtual bool ReadToDescendant(string name)
827 {
828 if (name == null || name.Length == 0)
829 {
831 }
832 int num = Depth;
833 if (NodeType != XmlNodeType.Element)
834 {
835 if (ReadState != 0)
836 {
837 return false;
838 }
839 num--;
840 }
841 else if (IsEmptyElement)
842 {
843 return false;
844 }
845 name = NameTable.Add(name);
846 while (Read() && Depth > num)
847 {
848 if (NodeType == XmlNodeType.Element && Ref.Equal(name, Name))
849 {
850 return true;
851 }
852 }
853 return false;
854 }
855
856 public virtual bool ReadToDescendant(string localName, string namespaceURI)
857 {
858 if (localName == null || localName.Length == 0)
859 {
860 throw XmlConvert.CreateInvalidNameArgumentException(localName, "localName");
861 }
862 if (namespaceURI == null)
863 {
864 throw new ArgumentNullException("namespaceURI");
865 }
866 int num = Depth;
867 if (NodeType != XmlNodeType.Element)
868 {
869 if (ReadState != 0)
870 {
871 return false;
872 }
873 num--;
874 }
875 else if (IsEmptyElement)
876 {
877 return false;
878 }
879 localName = NameTable.Add(localName);
881 while (Read() && Depth > num)
882 {
883 if (NodeType == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
884 {
885 return true;
886 }
887 }
888 return false;
889 }
890
891 public virtual bool ReadToNextSibling(string name)
892 {
893 if (name == null || name.Length == 0)
894 {
896 }
897 name = NameTable.Add(name);
898 while (SkipSubtree())
899 {
900 XmlNodeType nodeType = NodeType;
901 if (nodeType == XmlNodeType.Element && Ref.Equal(name, Name))
902 {
903 return true;
904 }
905 if (nodeType == XmlNodeType.EndElement || EOF)
906 {
907 break;
908 }
909 }
910 return false;
911 }
912
913 public virtual bool ReadToNextSibling(string localName, string namespaceURI)
914 {
915 if (localName == null || localName.Length == 0)
916 {
917 throw XmlConvert.CreateInvalidNameArgumentException(localName, "localName");
918 }
919 if (namespaceURI == null)
920 {
921 throw new ArgumentNullException("namespaceURI");
922 }
923 localName = NameTable.Add(localName);
925 while (SkipSubtree())
926 {
927 XmlNodeType nodeType = NodeType;
928 if (nodeType == XmlNodeType.Element && Ref.Equal(localName, LocalName) && Ref.Equal(namespaceURI, NamespaceURI))
929 {
930 return true;
931 }
932 if (nodeType == XmlNodeType.EndElement || EOF)
933 {
934 break;
935 }
936 }
937 return false;
938 }
939
940 public static bool IsName(string str)
941 {
942 if (str == null)
943 {
944 throw new NullReferenceException();
945 }
947 }
948
949 public static bool IsNameToken(string str)
950 {
951 if (str == null)
952 {
953 throw new NullReferenceException();
954 }
956 }
957
958 public virtual string ReadInnerXml()
959 {
960 if (ReadState != ReadState.Interactive)
961 {
962 return string.Empty;
963 }
964 if (NodeType != XmlNodeType.Attribute && NodeType != XmlNodeType.Element)
965 {
966 Read();
967 return string.Empty;
968 }
971 try
972 {
973 if (NodeType == XmlNodeType.Attribute)
974 {
975 ((XmlTextWriter)xmlWriter).QuoteChar = QuoteChar;
977 }
978 if (NodeType == XmlNodeType.Element)
979 {
980 WriteNode(xmlWriter, defattr: false);
981 }
982 }
983 finally
984 {
985 xmlWriter.Close();
986 }
987 return stringWriter.ToString();
988 }
989
990 private void WriteNode(XmlWriter xtw, bool defattr)
991 {
992 int num = ((NodeType == XmlNodeType.None) ? (-1) : Depth);
993 while (Read() && num < Depth)
994 {
995 switch (NodeType)
996 {
997 case XmlNodeType.Element:
998 xtw.WriteStartElement(Prefix, LocalName, NamespaceURI);
999 ((XmlTextWriter)xtw).QuoteChar = QuoteChar;
1000 xtw.WriteAttributes(this, defattr);
1001 if (IsEmptyElement)
1002 {
1003 xtw.WriteEndElement();
1004 }
1005 break;
1006 case XmlNodeType.Text:
1007 xtw.WriteString(Value);
1008 break;
1009 case XmlNodeType.Whitespace:
1010 case XmlNodeType.SignificantWhitespace:
1011 xtw.WriteWhitespace(Value);
1012 break;
1013 case XmlNodeType.CDATA:
1014 xtw.WriteCData(Value);
1015 break;
1016 case XmlNodeType.EntityReference:
1017 xtw.WriteEntityRef(Name);
1018 break;
1019 case XmlNodeType.ProcessingInstruction:
1020 case XmlNodeType.XmlDeclaration:
1021 xtw.WriteProcessingInstruction(Name, Value);
1022 break;
1023 case XmlNodeType.DocumentType:
1024 xtw.WriteDocType(Name, GetAttribute("PUBLIC"), GetAttribute("SYSTEM"), Value);
1025 break;
1026 case XmlNodeType.Comment:
1027 xtw.WriteComment(Value);
1028 break;
1029 case XmlNodeType.EndElement:
1030 xtw.WriteFullEndElement();
1031 break;
1032 }
1033 }
1034 if (num == Depth && NodeType == XmlNodeType.EndElement)
1035 {
1036 Read();
1037 }
1038 }
1039
1041 {
1042 string name = Name;
1043 while (ReadAttributeValue())
1044 {
1045 if (NodeType == XmlNodeType.EntityReference)
1046 {
1047 xtw.WriteEntityRef(Name);
1048 }
1049 else
1050 {
1051 xtw.WriteString(Value);
1052 }
1053 }
1054 MoveToAttribute(name);
1055 }
1056
1057 public virtual string ReadOuterXml()
1058 {
1059 if (ReadState != ReadState.Interactive)
1060 {
1061 return string.Empty;
1062 }
1063 if (NodeType != XmlNodeType.Attribute && NodeType != XmlNodeType.Element)
1064 {
1065 Read();
1066 return string.Empty;
1067 }
1070 try
1071 {
1072 if (NodeType == XmlNodeType.Attribute)
1073 {
1074 xmlWriter.WriteStartAttribute(Prefix, LocalName, NamespaceURI);
1076 xmlWriter.WriteEndAttribute();
1077 }
1078 else
1079 {
1080 xmlWriter.WriteNode(this, defattr: false);
1081 }
1082 }
1083 finally
1084 {
1085 xmlWriter.Close();
1086 }
1087 return stringWriter.ToString();
1088 }
1089
1096
1098 {
1100 {
1101 xtw.Namespaces = xmlTextReader.Namespaces;
1102 }
1104 {
1106 }
1107 }
1108
1109 public virtual XmlReader ReadSubtree()
1110 {
1111 if (NodeType != XmlNodeType.Element)
1112 {
1114 }
1115 return new XmlSubtreeReader(this);
1116 }
1117
1118 public void Dispose()
1119 {
1120 Dispose(disposing: true);
1121 }
1122
1123 protected virtual void Dispose(bool disposing)
1124 {
1125 if (disposing && ReadState != ReadState.Closed)
1126 {
1127 Close();
1128 }
1129 }
1130
1131 internal static bool IsTextualNode(XmlNodeType nodeType)
1132 {
1133 return (0x6018uL & (ulong)(1 << (int)nodeType)) != 0;
1134 }
1135
1136 internal static bool CanReadContentAs(XmlNodeType nodeType)
1137 {
1138 return (0x1E1BCuL & (ulong)(1 << (int)nodeType)) != 0;
1139 }
1140
1141 internal static bool HasValueInternal(XmlNodeType nodeType)
1142 {
1143 return (0x2659CuL & (ulong)(1 << (int)nodeType)) != 0;
1144 }
1145
1146 private bool SkipSubtree()
1147 {
1148 MoveToElement();
1149 if (NodeType == XmlNodeType.Element && !IsEmptyElement)
1150 {
1151 int depth = Depth;
1152 while (Read() && depth < Depth)
1153 {
1154 }
1155 if (NodeType == XmlNodeType.EndElement)
1156 {
1157 return Read();
1158 }
1159 return false;
1160 }
1161 return Read();
1162 }
1163
1164 internal void CheckElement(string localName, string namespaceURI)
1165 {
1166 if (localName == null || localName.Length == 0)
1167 {
1168 throw XmlConvert.CreateInvalidNameArgumentException(localName, "localName");
1169 }
1170 if (namespaceURI == null)
1171 {
1172 throw new ArgumentNullException("namespaceURI");
1173 }
1174 if (NodeType != XmlNodeType.Element)
1175 {
1176 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString(), this as IXmlLineInfo);
1177 }
1178 if (LocalName != localName || NamespaceURI != namespaceURI)
1179 {
1180 throw new XmlException(System.SR.Xml_ElementNotFoundNs, new string[2] { localName, namespaceURI }, this as IXmlLineInfo);
1181 }
1182 }
1183
1188
1193
1194 internal bool CanReadContentAs()
1195 {
1196 return CanReadContentAs(NodeType);
1197 }
1198
1200 {
1202 }
1203
1208
1209 private static string AddLineInfo(string message, IXmlLineInfo lineInfo)
1210 {
1211 if (lineInfo != null)
1212 {
1213 object[] args = new object[2]
1214 {
1215 lineInfo.LineNumber.ToString(CultureInfo.InvariantCulture),
1216 lineInfo.LinePosition.ToString(CultureInfo.InvariantCulture)
1217 };
1218 message = message + " " + System.SR.Format(System.SR.Xml_ErrorPosition, args);
1219 }
1220 return message;
1221 }
1222
1224 {
1225 string text = string.Empty;
1227 bool num;
1228 do
1229 {
1230 switch (NodeType)
1231 {
1232 case XmlNodeType.Attribute:
1233 return Value;
1234 case XmlNodeType.Text:
1235 case XmlNodeType.CDATA:
1236 case XmlNodeType.Whitespace:
1237 case XmlNodeType.SignificantWhitespace:
1238 if (text.Length == 0)
1239 {
1240 text = Value;
1241 }
1242 else
1243 {
1244 if (stringBuilder == null)
1245 {
1247 stringBuilder.Append(text);
1248 }
1249 stringBuilder.Append(Value);
1250 }
1251 goto case XmlNodeType.ProcessingInstruction;
1252 case XmlNodeType.EntityReference:
1253 if (!CanResolveEntity)
1254 {
1255 break;
1256 }
1257 ResolveEntity();
1258 goto case XmlNodeType.ProcessingInstruction;
1259 case XmlNodeType.ProcessingInstruction:
1260 case XmlNodeType.Comment:
1261 case XmlNodeType.EndEntity:
1262 num = ((AttributeCount != 0) ? ReadAttributeValue() : Read());
1263 continue;
1264 }
1265 break;
1266 }
1267 while (num);
1268 if (stringBuilder != null)
1269 {
1270 return stringBuilder.ToString();
1271 }
1272 return text;
1273 }
1274
1276 {
1277 if (NodeType != XmlNodeType.Element)
1278 {
1280 }
1282 Read();
1283 if (isEmptyElement)
1284 {
1285 return false;
1286 }
1287 switch (NodeType)
1288 {
1289 case XmlNodeType.EndElement:
1290 Read();
1291 return false;
1292 case XmlNodeType.Element:
1293 throw new XmlException(System.SR.Xml_MixedReadElementContentAs, string.Empty, this as IXmlLineInfo);
1294 default:
1295 return true;
1296 }
1297 }
1298
1300 {
1301 if (NodeType != XmlNodeType.EndElement)
1302 {
1303 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString());
1304 }
1305 Read();
1306 }
1307
1309 {
1310 return GetXmlTextReaderImpl(reader)?.V1ComformanceLevel ?? ConformanceLevel.Document;
1311 }
1312
1314 {
1315 if (reader is XmlTextReaderImpl result)
1316 {
1317 return result;
1318 }
1319 if (reader is XmlTextReader xmlTextReader)
1320 {
1321 return xmlTextReader.Impl;
1322 }
1324 {
1325 return xmlValidatingReaderImpl.ReaderImpl;
1326 }
1328 {
1329 return xmlValidatingReader.Impl.ReaderImpl;
1330 }
1331 return null;
1332 }
1333
1334 public static XmlReader Create(string inputUri)
1335 {
1336 if (inputUri == null)
1337 {
1338 throw new ArgumentNullException("inputUri");
1339 }
1340 if (inputUri.Length == 0)
1341 {
1342 throw new ArgumentException(System.SR.XmlConvert_BadUri, "inputUri");
1343 }
1345 }
1346
1347 public static XmlReader Create(string inputUri, XmlReaderSettings? settings)
1348 {
1349 return Create(inputUri, settings, null);
1350 }
1351
1352 public static XmlReader Create(string inputUri, XmlReaderSettings? settings, XmlParserContext? inputContext)
1353 {
1354 if (settings == null)
1355 {
1357 }
1358 return settings.CreateReader(inputUri, inputContext);
1359 }
1360
1362 {
1363 if (input == null)
1364 {
1365 throw new ArgumentNullException("input");
1366 }
1367 return new XmlTextReaderImpl(input, null, 0, XmlReaderSettings.s_defaultReaderSettings, null, string.Empty, null, closeInput: false);
1368 }
1369
1371 {
1372 return Create(input, settings, string.Empty);
1373 }
1374
1375 public static XmlReader Create(Stream input, XmlReaderSettings? settings, string? baseUri)
1376 {
1377 if (settings == null)
1378 {
1380 }
1381 return settings.CreateReader(input, null, baseUri, null);
1382 }
1383
1384 public static XmlReader Create(Stream input, XmlReaderSettings? settings, XmlParserContext? inputContext)
1385 {
1386 if (settings == null)
1387 {
1389 }
1390 return settings.CreateReader(input, null, string.Empty, inputContext);
1391 }
1392
1394 {
1395 if (input == null)
1396 {
1397 throw new ArgumentNullException("input");
1398 }
1399 return new XmlTextReaderImpl(input, XmlReaderSettings.s_defaultReaderSettings, string.Empty, null);
1400 }
1401
1403 {
1404 return Create(input, settings, string.Empty);
1405 }
1406
1407 public static XmlReader Create(TextReader input, XmlReaderSettings? settings, string? baseUri)
1408 {
1409 if (settings == null)
1410 {
1412 }
1413 return settings.CreateReader(input, baseUri, null);
1414 }
1415
1416 public static XmlReader Create(TextReader input, XmlReaderSettings? settings, XmlParserContext? inputContext)
1417 {
1418 if (settings == null)
1419 {
1421 }
1422 return settings.CreateReader(input, string.Empty, inputContext);
1423 }
1424
1425 public static XmlReader Create(XmlReader reader, XmlReaderSettings? settings)
1426 {
1427 if (settings == null)
1428 {
1430 }
1431 return settings.CreateReader(reader);
1432 }
1433
1435 {
1436 if (input == null)
1437 {
1438 throw new ArgumentNullException("input");
1439 }
1440 if (settings == null)
1441 {
1443 }
1444 byte[] array = new byte[CalcBufferSize(input)];
1445 int num = 0;
1446 int num2;
1447 do
1448 {
1449 num2 = input.Read(array, num, array.Length - num);
1450 num += num2;
1451 }
1452 while (num2 > 0 && num < 2);
1454 if (num >= 2 && array[0] == 223 && array[1] == byte.MaxValue)
1455 {
1456 if (inputContext != null)
1457 {
1458 throw new ArgumentException(System.SR.XmlBinary_NoParserContext, "inputContext");
1459 }
1460 xmlReader = new XmlSqlBinaryReader(input, array, num, string.Empty, settings.CloseInput, settings);
1461 }
1462 else
1463 {
1464 xmlReader = new XmlTextReaderImpl(input, array, num, settings, null, string.Empty, inputContext, settings.CloseInput);
1465 }
1466 if (settings.ValidationType != 0)
1467 {
1468 xmlReader = settings.AddValidation(xmlReader);
1469 }
1470 if (settings.Async)
1471 {
1473 }
1474 return xmlReader;
1475 }
1476
1477 internal static int CalcBufferSize(Stream input)
1478 {
1479 int num = 4096;
1480 if (input.CanSeek)
1481 {
1482 long length = input.Length;
1483 if (length < num)
1484 {
1485 num = checked((int)length);
1486 }
1487 else if (length > 65536)
1488 {
1489 num = 8192;
1490 }
1491 }
1492 return num;
1493 }
1494
1496 {
1497 throw new NotImplementedException();
1498 }
1499
1501 {
1502 if (!CanReadContentAs())
1503 {
1504 throw CreateReadContentAsException("ReadContentAsObject");
1505 }
1507 }
1508
1510 {
1511 if (!CanReadContentAs())
1512 {
1513 throw CreateReadContentAsException("ReadContentAsString");
1514 }
1516 }
1517
1519 {
1520 if (!CanReadContentAs())
1521 {
1522 throw CreateReadContentAsException("ReadContentAs");
1523 }
1524 string text = await InternalReadContentAsStringAsync().ConfigureAwait(continueOnCapturedContext: false);
1525 if (returnType == typeof(string))
1526 {
1527 return text;
1528 }
1529 try
1530 {
1532 }
1534 {
1536 }
1538 {
1540 }
1541 }
1542
1544 {
1545 if (await SetupReadElementContentAsXxxAsync("ReadElementContentAsObject").ConfigureAwait(continueOnCapturedContext: false))
1546 {
1547 object value = await ReadContentAsObjectAsync().ConfigureAwait(continueOnCapturedContext: false);
1549 return value;
1550 }
1551 return string.Empty;
1552 }
1553
1555 {
1556 if (await SetupReadElementContentAsXxxAsync("ReadElementContentAsString").ConfigureAwait(continueOnCapturedContext: false))
1557 {
1558 string value = await ReadContentAsStringAsync().ConfigureAwait(continueOnCapturedContext: false);
1560 return value;
1561 }
1562 return string.Empty;
1563 }
1564
1575
1576 public virtual Task<bool> ReadAsync()
1577 {
1578 throw new NotImplementedException();
1579 }
1580
1581 public virtual Task SkipAsync()
1582 {
1583 if (ReadState != ReadState.Interactive)
1584 {
1585 return Task.CompletedTask;
1586 }
1587 return SkipSubtreeAsync();
1588 }
1589
1590 public virtual Task<int> ReadContentAsBase64Async(byte[] buffer, int index, int count)
1591 {
1593 }
1594
1596 {
1597 throw new NotSupportedException(System.SR.Format(System.SR.Xml_ReadBinaryContentNotSupported, "ReadElementContentAsBase64"));
1598 }
1599
1600 public virtual Task<int> ReadContentAsBinHexAsync(byte[] buffer, int index, int count)
1601 {
1603 }
1604
1606 {
1607 throw new NotSupportedException(System.SR.Format(System.SR.Xml_ReadBinaryContentNotSupported, "ReadElementContentAsBinHex"));
1608 }
1609
1610 public virtual Task<int> ReadValueChunkAsync(char[] buffer, int index, int count)
1611 {
1613 }
1614
1616 {
1617 do
1618 {
1619 switch (NodeType)
1620 {
1621 case XmlNodeType.Attribute:
1622 MoveToElement();
1623 break;
1624 case XmlNodeType.Element:
1625 case XmlNodeType.Text:
1626 case XmlNodeType.CDATA:
1627 case XmlNodeType.EntityReference:
1628 case XmlNodeType.EndElement:
1629 case XmlNodeType.EndEntity:
1630 break;
1631 default:
1632 continue;
1633 }
1634 return NodeType;
1635 }
1636 while (await ReadAsync().ConfigureAwait(continueOnCapturedContext: false));
1637 return NodeType;
1638 }
1639
1641 {
1642 if (ReadState != ReadState.Interactive)
1643 {
1644 return string.Empty;
1645 }
1646 if (NodeType != XmlNodeType.Attribute && NodeType != XmlNodeType.Element)
1647 {
1649 return string.Empty;
1650 }
1653 try
1654 {
1655 if (NodeType == XmlNodeType.Attribute)
1656 {
1657 ((XmlTextWriter)xtw).QuoteChar = QuoteChar;
1659 }
1660 if (NodeType == XmlNodeType.Element)
1661 {
1662 await WriteNodeAsync(xtw, defattr: false).ConfigureAwait(continueOnCapturedContext: false);
1663 }
1664 }
1665 finally
1666 {
1667 xtw.Close();
1668 }
1669 return sw.ToString();
1670 }
1671
1673 {
1674 int d = ((NodeType == XmlNodeType.None) ? (-1) : Depth);
1676 {
1677 switch (NodeType)
1678 {
1679 case XmlNodeType.Element:
1680 xtw.WriteStartElement(Prefix, LocalName, NamespaceURI);
1681 ((XmlTextWriter)xtw).QuoteChar = QuoteChar;
1682 xtw.WriteAttributes(this, defattr);
1683 if (IsEmptyElement)
1684 {
1685 xtw.WriteEndElement();
1686 }
1687 break;
1688 case XmlNodeType.Text:
1689 {
1692 break;
1693 }
1694 case XmlNodeType.Whitespace:
1695 case XmlNodeType.SignificantWhitespace:
1696 {
1699 break;
1700 }
1701 case XmlNodeType.CDATA:
1702 xtw.WriteCData(Value);
1703 break;
1704 case XmlNodeType.EntityReference:
1705 xtw.WriteEntityRef(Name);
1706 break;
1707 case XmlNodeType.ProcessingInstruction:
1708 case XmlNodeType.XmlDeclaration:
1709 xtw.WriteProcessingInstruction(Name, Value);
1710 break;
1711 case XmlNodeType.DocumentType:
1712 xtw.WriteDocType(Name, GetAttribute("PUBLIC"), GetAttribute("SYSTEM"), Value);
1713 break;
1714 case XmlNodeType.Comment:
1715 xtw.WriteComment(Value);
1716 break;
1717 case XmlNodeType.EndElement:
1718 xtw.WriteFullEndElement();
1719 break;
1720 }
1721 }
1722 if (d == Depth && NodeType == XmlNodeType.EndElement)
1723 {
1725 }
1726 }
1727
1729 {
1730 if (ReadState != ReadState.Interactive)
1731 {
1732 return string.Empty;
1733 }
1734 if (NodeType != XmlNodeType.Attribute && NodeType != XmlNodeType.Element)
1735 {
1737 return string.Empty;
1738 }
1741 try
1742 {
1743 if (NodeType == XmlNodeType.Attribute)
1744 {
1745 xmlWriter.WriteStartAttribute(Prefix, LocalName, NamespaceURI);
1747 xmlWriter.WriteEndAttribute();
1748 }
1749 else
1750 {
1751 xmlWriter.WriteNode(this, defattr: false);
1752 }
1753 }
1754 finally
1755 {
1756 xmlWriter.Close();
1757 }
1758 return stringWriter.ToString();
1759 }
1760
1762 {
1763 MoveToElement();
1764 if (NodeType == XmlNodeType.Element && !IsEmptyElement)
1765 {
1766 int depth = Depth;
1767 while (await ReadAsync().ConfigureAwait(continueOnCapturedContext: false) && depth < Depth)
1768 {
1769 }
1770 if (NodeType == XmlNodeType.EndElement)
1771 {
1773 }
1774 return false;
1775 }
1777 }
1778
1780 {
1781 string value = string.Empty;
1782 StringBuilder sb = null;
1783 bool flag;
1784 do
1785 {
1786 switch (NodeType)
1787 {
1788 case XmlNodeType.Attribute:
1789 return Value;
1790 case XmlNodeType.Text:
1791 case XmlNodeType.CDATA:
1792 case XmlNodeType.Whitespace:
1793 case XmlNodeType.SignificantWhitespace:
1794 if (value.Length == 0)
1795 {
1796 value = await GetValueAsync().ConfigureAwait(continueOnCapturedContext: false);
1797 }
1798 else
1799 {
1800 if (sb == null)
1801 {
1802 sb = new StringBuilder();
1803 sb.Append(value);
1804 }
1807 }
1808 goto case XmlNodeType.ProcessingInstruction;
1809 case XmlNodeType.EntityReference:
1810 if (!CanResolveEntity)
1811 {
1812 break;
1813 }
1814 ResolveEntity();
1815 goto case XmlNodeType.ProcessingInstruction;
1816 case XmlNodeType.ProcessingInstruction:
1817 case XmlNodeType.Comment:
1818 case XmlNodeType.EndEntity:
1820 continue;
1821 }
1822 break;
1823 }
1824 while (flag);
1825 return (sb == null) ? value : sb.ToString();
1826 }
1827
1829 {
1830 if (NodeType != XmlNodeType.Element)
1831 {
1833 }
1836 if (isEmptyElement)
1837 {
1838 return false;
1839 }
1840 switch (NodeType)
1841 {
1842 case XmlNodeType.EndElement:
1844 return false;
1845 case XmlNodeType.Element:
1846 throw new XmlException(System.SR.Xml_MixedReadElementContentAs, string.Empty, this as IXmlLineInfo);
1847 default:
1848 return true;
1849 }
1850 }
1851
1853 {
1854 if (NodeType != XmlNodeType.EndElement)
1855 {
1856 throw new XmlException(System.SR.Xml_InvalidNodeType, NodeType.ToString());
1857 }
1858 return ReadAsync();
1859 }
1860}
static CultureInfo InvariantCulture
static string XmlBinary_NoParserContext
Definition SR.cs:1378
static string Xml_InvalidReadContentAs
Definition SR.cs:176
static string Xml_ElementNotFoundNs
Definition SR.cs:102
static string Xml_ReadBinaryContentNotSupported
Definition SR.cs:172
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Xml_ErrorPosition
Definition SR.cs:58
static string Xml_ReadValueChunkNotSupported
Definition SR.cs:174
static string Xml_ReadContentAsFormatException
Definition SR.cs:190
static string Xml_InvalidNodeType
Definition SR.cs:88
static string Xml_InvalidReadElementContentAs
Definition SR.cs:178
static string Xml_ElementNotFound
Definition SR.cs:100
static string Xml_ReadSubtreeNotOnElement
Definition SR.cs:162
static string Xml_InvalidOperation
Definition SR.cs:18
static string Xml_MixedReadElementContentAs
Definition SR.cs:180
static string Xml_UnexpectedNodeInSimpleContent
Definition SR.cs:198
static string XmlConvert_BadUri
Definition SR.cs:368
Definition SR.cs:7
override string ToString()
StringBuilder Append(char value, int repeatCount)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
static Task CompletedTask
Definition Task.cs:1120
override string Add(string key)
Definition NameTable.cs:33
static bool Equal(string strA, string strB)
Definition Ref.cs:5
static readonly XmlValueConverter Untyped
static bool IsNameNoNamespaces(string s)
static bool IsNmtokenNoNamespaces(string s)
static XmlAsyncCheckReader CreateAsyncCheckWrapper(XmlReader reader)
static bool ToBoolean(string s)
static DateTimeOffset ToDateTimeOffset(string s)
static int ToInt32(string s)
static float ToSingle(string s)
static ArgumentException CreateInvalidNameArgumentException(string name, string argumentName)
static double ToDouble(string s)
static DateTime ToDateTime(string s)
static decimal ToDecimal(string s)
static string EscapeValueForDebuggerDisplay(string value)
static long ToInt64(string s)
XmlReader AddValidation(XmlReader reader)
XmlReader CreateReader(string inputUri, XmlParserContext inputContext)
static readonly XmlReaderSettings s_defaultReaderSettings
static bool IsTextualNode(XmlNodeType nodeType)
virtual Task< int > ReadElementContentAsBinHexAsync(byte[] buffer, int index, int count)
virtual string ReadElementContentAsString(string localName, string namespaceURI)
Definition XmlReader.cs:467
bool MoveToAttribute(string name, string? ns)
virtual string ReadContentAsString()
Definition XmlReader.cs:286
virtual object ReadElementContentAsObject()
Definition XmlReader.cs:320
Exception CreateReadElementContentAsException(string methodName)
XmlWriter CreateWriterForInnerOuterXml(StringWriter sw)
object DebuggerDisplayProxy
Definition XmlReader.cs:147
virtual void ReadStartElement(string localname, string ns)
Definition XmlReader.cs:652
virtual object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver)
Definition XmlReader.cs:473
virtual long ReadContentAsLong()
Definition XmlReader.cs:270
static string AddLineInfo(string message, IXmlLineInfo lineInfo)
virtual float ReadElementContentAsFloat(string localName, string namespaceURI)
Definition XmlReader.cs:399
string? GetAttribute(string name)
virtual bool HasValue
Definition XmlReader.cs:82
async Task< string > InternalReadContentAsStringAsync()
virtual double ReadElementContentAsDouble(string localName, string namespaceURI)
Definition XmlReader.cs:382
virtual bool CanResolveEntity
Definition XmlReader.cs:118
virtual DateTime ReadElementContentAsDateTime()
Definition XmlReader.cs:354
string? GetAttribute(string name, string? namespaceURI)
virtual bool ReadToNextSibling(string name)
Definition XmlReader.cs:891
virtual void Skip()
Definition XmlReader.cs:532
virtual bool IsStartElement()
Definition XmlReader.cs:760
static XmlReader Create(Stream input, XmlReaderSettings? settings, XmlParserContext? inputContext)
virtual long ReadElementContentAsLong()
Definition XmlReader.cs:439
virtual void ReadStartElement()
Definition XmlReader.cs:629
virtual bool ReadToDescendant(string localName, string namespaceURI)
Definition XmlReader.cs:856
virtual double ReadElementContentAsDouble()
Definition XmlReader.cs:371
virtual Task< int > ReadContentAsBinHexAsync(byte[] buffer, int index, int count)
virtual Task SkipAsync()
async Task< bool > SetupReadElementContentAsXxxAsync(string methodName)
virtual void ReadStartElement(string name)
Definition XmlReader.cs:638
static bool IsNameToken(string str)
Definition XmlReader.cs:949
static XmlReader Create(TextReader input, XmlReaderSettings? settings)
virtual void ReadEndElement()
Definition XmlReader.cs:751
virtual bool ReadElementContentAsBoolean(string localName, string namespaceURI)
Definition XmlReader.cs:348
bool MoveToAttribute(string name)
virtual bool IsStartElement(string localname, string ns)
Definition XmlReader.cs:774
void SetNamespacesFlag(XmlTextWriter xtw)
virtual string ReadInnerXml()
Definition XmlReader.cs:958
void CheckElement(string localName, string namespaceURI)
virtual XmlReader ReadSubtree()
Exception CreateReadContentAsException(string methodName)
virtual async Task< object > ReadContentAsObjectAsync()
virtual ? XmlReaderSettings Settings
Definition XmlReader.cs:60
virtual DateTime ReadElementContentAsDateTime(string localName, string namespaceURI)
Definition XmlReader.cs:365
virtual ? IXmlSchemaInfo SchemaInfo
Definition XmlReader.cs:100
virtual object ReadElementContentAsObject(string localName, string namespaceURI)
Definition XmlReader.cs:331
static XmlReader Create(XmlReader reader, XmlReaderSettings? settings)
async Task WriteNodeAsync(XmlWriter xtw, bool defattr)
bool SetupReadElementContentAsXxx(string methodName)
static bool HasValueInternal(XmlNodeType nodeType)
void FinishReadElementContentAsXxx()
virtual async Task< object > ReadElementContentAsObjectAsync()
static XmlReader Create(Stream input)
static int CalcBufferSize(Stream input)
virtual DateTimeOffset ReadContentAsDateTimeOffset()
Definition XmlReader.cs:190
virtual int ReadValueChunk(char[] buffer, int index, int count)
Definition XmlReader.cs:564
virtual bool HasAttributes
Definition XmlReader.cs:124
virtual string ReadElementString(string localname, string ns)
Definition XmlReader.cs:724
virtual bool IsDefault
Definition XmlReader.cs:92
virtual void Dispose(bool disposing)
virtual int ReadContentAsBinHex(byte[] buffer, int index, int count)
Definition XmlReader.cs:554
virtual float ReadContentAsFloat()
Definition XmlReader.cs:222
static XmlReader Create(Stream input, XmlReaderSettings? settings)
virtual int ReadContentAsInt()
Definition XmlReader.cs:254
virtual bool ReadContentAsBoolean()
Definition XmlReader.cs:158
virtual decimal ReadElementContentAsDecimal(string localName, string namespaceURI)
Definition XmlReader.cs:416
virtual async Task< XmlNodeType > MoveToContentAsync()
async Task< bool > SkipSubtreeAsync()
virtual async Task< string > ReadOuterXmlAsync()
virtual Task< int > ReadValueChunkAsync(char[] buffer, int index, int count)
virtual object ReadElementContentAs(Type returnType, IXmlNamespaceResolver namespaceResolver, string localName, string namespaceURI)
Definition XmlReader.cs:488
virtual char QuoteChar
Definition XmlReader.cs:94
static XmlReader Create(string inputUri, XmlReaderSettings? settings)
virtual async Task< string > ReadElementContentAsStringAsync()
virtual string ReadOuterXml()
virtual ? IDtdInfo DtdInfo
Definition XmlReader.cs:145
virtual Task< bool > ReadAsync()
virtual int ReadElementContentAsBase64(byte[] buffer, int index, int count)
Definition XmlReader.cs:549
virtual decimal ReadContentAsDecimal()
Definition XmlReader.cs:238
string GetAttribute(int i)
virtual string XmlLang
Definition XmlReader.cs:98
virtual object ReadContentAsObject()
Definition XmlReader.cs:149
static XmlReader CreateSqlReader(Stream input, XmlReaderSettings settings, XmlParserContext inputContext)
string? LookupNamespace(string prefix)
virtual string ReadElementString(string name)
Definition XmlReader.cs:696
void WriteAttributeValue(XmlWriter xtw)
virtual double ReadContentAsDouble()
Definition XmlReader.cs:206
virtual bool ReadToDescendant(string name)
Definition XmlReader.cs:826
virtual bool ReadToNextSibling(string localName, string namespaceURI)
Definition XmlReader.cs:913
virtual bool ReadToFollowing(string name)
Definition XmlReader.cs:787
virtual DateTime ReadContentAsDateTime()
Definition XmlReader.cs:174
virtual bool ReadToFollowing(string localName, string namespaceURI)
Definition XmlReader.cs:804
virtual int ReadElementContentAsInt()
Definition XmlReader.cs:422
virtual XmlNodeType MoveToContent()
Definition XmlReader.cs:604
virtual void Close()
Definition XmlReader.cs:528
virtual Task< string > ReadContentAsStringAsync()
void WriteNode(XmlWriter xtw, bool defattr)
Definition XmlReader.cs:990
virtual string ReadElementString()
Definition XmlReader.cs:667
virtual async Task< object > ReadElementContentAsAsync(Type returnType, IXmlNamespaceResolver namespaceResolver)
static XmlReader Create(TextReader input, XmlReaderSettings? settings, string? baseUri)
virtual Task< int > ReadContentAsBase64Async(byte[] buffer, int index, int count)
virtual int ReadElementContentAsInt(string localName, string namespaceURI)
Definition XmlReader.cs:433
virtual int ReadContentAsBase64(byte[] buffer, int index, int count)
Definition XmlReader.cs:544
XmlNodeType NodeType
Definition XmlReader.cs:62
virtual object ReadContentAs(Type returnType, IXmlNamespaceResolver? namespaceResolver)
Definition XmlReader.cs:295
static XmlReader Create(string inputUri, XmlReaderSettings? settings, XmlParserContext? inputContext)
virtual string ReadString()
Definition XmlReader.cs:570
static XmlReader Create(TextReader input, XmlReaderSettings? settings, XmlParserContext? inputContext)
virtual ? XmlNamespaceManager NamespaceManager
Definition XmlReader.cs:126
static bool CanReadContentAs(XmlNodeType nodeType)
static XmlTextReaderImpl GetXmlTextReaderImpl(XmlReader reader)
virtual float ReadElementContentAsFloat()
Definition XmlReader.cs:388
static bool IsName(string str)
Definition XmlReader.cs:940
Task FinishReadElementContentAsXxxAsync()
static XmlReader Create(string inputUri)
virtual Task< int > ReadElementContentAsBase64Async(byte[] buffer, int index, int count)
virtual async Task< object > ReadContentAsAsync(Type returnType, IXmlNamespaceResolver? namespaceResolver)
virtual int ReadElementContentAsBinHex(byte[] buffer, int index, int count)
Definition XmlReader.cs:559
virtual decimal ReadElementContentAsDecimal()
Definition XmlReader.cs:405
static XmlReader Create(Stream input, XmlReaderSettings? settings, string? baseUri)
virtual Task< string > GetValueAsync()
virtual async Task< string > ReadInnerXmlAsync()
static Exception CreateReadElementContentAsException(string methodName, XmlNodeType nodeType, IXmlLineInfo lineInfo)
static ConformanceLevel GetV1ConformanceLevel(XmlReader reader)
virtual void MoveToAttribute(int i)
Definition XmlReader.cs:504
static Exception CreateReadContentAsException(string methodName, XmlNodeType nodeType, IXmlLineInfo lineInfo)
virtual bool IsStartElement(string name)
Definition XmlReader.cs:765
virtual bool ReadElementContentAsBoolean()
Definition XmlReader.cs:337
virtual string Name
Definition XmlReader.cs:65
virtual string ReadElementContentAsString()
Definition XmlReader.cs:456
string InternalReadContentAsString()
static XmlReader Create(TextReader input)
virtual bool CanReadValueChunk
Definition XmlReader.cs:122
virtual long ReadElementContentAsLong(string localName, string namespaceURI)
Definition XmlReader.cs:450
virtual bool CanReadBinaryContent
Definition XmlReader.cs:120
void WriteString(string? text)
void WriteWhitespace(string? ws)