Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XElement.cs
Go to the documentation of this file.
5using System.IO;
8using System.Text;
13
14namespace System.Xml.Linq;
15
16[XmlSchemaProvider(null, IsAny = true)]
17[TypeDescriptionProvider("MS.Internal.Xml.Linq.ComponentModel.XTypeDescriptionProvider`1[[System.Xml.Linq.XElement, System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]],System.ComponentModel.TypeConverter")]
19{
20 [StructLayout(LayoutKind.Sequential, Size = 1)]
22 {
23 }
24
25 internal XName name;
26
28
30
32 {
33 get
34 {
35 if (lastAttr == null)
36 {
37 return null;
38 }
39 return lastAttr.next;
40 }
41 }
42
43 public bool HasAttributes => lastAttr != null;
44
45 public bool HasElements
46 {
47 get
48 {
50 if (xNode != null)
51 {
52 do
53 {
54 if (xNode is XElement)
55 {
56 return true;
57 }
58 xNode = xNode.next;
59 }
60 while (xNode != content);
61 }
62 return false;
63 }
64 }
65
66 public bool IsEmpty => content == null;
67
69
70 public XName Name
71 {
72 get
73 {
74 return name;
75 }
76 set
77 {
78 if (value == null)
79 {
80 throw new ArgumentNullException("value");
81 }
83 name = value;
84 if (flag)
85 {
87 }
88 }
89 }
90
91 public override XmlNodeType NodeType => XmlNodeType.Element;
92
93 public string Value
94 {
95 get
96 {
97 if (content == null)
98 {
99 return string.Empty;
100 }
101 if (content is string result)
102 {
103 return result;
104 }
106 AppendText(sb);
108 }
109 set
110 {
111 if (value == null)
112 {
113 throw new ArgumentNullException("value");
114 }
115 RemoveNodes();
116 Add(value);
117 }
118 }
119
121 {
122 if (name == null)
123 {
124 throw new ArgumentNullException("name");
125 }
126 this.name = name;
127 }
128
129 public XElement(XName name, object? content)
130 : this(name)
131 {
133 }
134
135 public XElement(XName name, params object?[] content)
136 : this(name, (object?)content)
137 {
138 }
139
141 : base(other)
142 {
143 name = other.name;
144 XAttribute xAttribute = other.lastAttr;
145 if (xAttribute != null)
146 {
147 do
148 {
149 xAttribute = xAttribute.next;
151 }
152 while (xAttribute != other.lastAttr);
153 }
154 }
155
157 {
158 if (other == null)
159 {
160 throw new ArgumentNullException("other");
161 }
162 name = other.name;
164 }
165
166 internal XElement()
167 : this("default")
168 {
169 }
170
173 {
174 }
175
177 {
178 }
179
181 {
183 }
184
186 {
188 await xe.ReadElementFromAsync(r, LoadOptions.None, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
189 return xe;
190 }
191
192 public void Save(string fileName)
193 {
195 }
196
203
205 {
206 return GetAncestors(null, self: true);
207 }
208
210 {
211 if (!(name != null))
212 {
213 return EmptySequence;
214 }
215 return GetAncestors(name, self: true);
216 }
217
219 {
221 if (xAttribute != null)
222 {
223 do
224 {
225 xAttribute = xAttribute.next;
226 if (xAttribute.name == name)
227 {
228 return xAttribute;
229 }
230 }
231 while (xAttribute != lastAttr);
232 }
233 return null;
234 }
235
237 {
238 return GetAttributes(null);
239 }
240
242 {
243 if (!(name != null))
244 {
246 }
247 return GetAttributes(name);
248 }
249
251 {
252 return GetDescendantNodes(self: true);
253 }
254
256 {
257 return GetDescendants(null, self: true);
258 }
259
261 {
262 if (!(name != null))
263 {
264 return EmptySequence;
265 }
266 return GetDescendants(name, self: true);
267 }
268
270 {
272 if (namespaceOfPrefixInScope == null)
273 {
274 return XNamespace.None;
275 }
277 }
278
280 {
281 if (prefix == null)
282 {
283 throw new ArgumentNullException("prefix");
284 }
285 if (prefix.Length == 0)
286 {
288 }
289 if (prefix == "xmlns")
290 {
291 return XNamespace.Xmlns;
292 }
294 if (namespaceOfPrefixInScope != null)
295 {
297 }
298 if (prefix == "xml")
299 {
300 return XNamespace.Xml;
301 }
302 return null;
303 }
304
306 {
307 if (ns == null)
308 {
309 throw new ArgumentNullException("ns");
310 }
311 string namespaceName = ns.NamespaceName;
312 bool flag = false;
313 XElement xElement = this;
314 do
315 {
316 XAttribute xAttribute = xElement.lastAttr;
317 if (xAttribute != null)
318 {
319 bool flag2 = false;
320 do
321 {
322 xAttribute = xAttribute.next;
323 if (xAttribute.IsNamespaceDeclaration)
324 {
325 if (xAttribute.Value == namespaceName && xAttribute.Name.NamespaceName.Length != 0 && (!flag || GetNamespaceOfPrefixInScope(xAttribute.Name.LocalName, xElement) == null))
326 {
327 return xAttribute.Name.LocalName;
328 }
329 flag2 = true;
330 }
331 }
332 while (xAttribute != xElement.lastAttr);
333 flag = flag || flag2;
334 }
336 }
337 while (xElement != null);
338 if ((object)namespaceName == "http://www.w3.org/XML/1998/namespace")
339 {
340 if (!flag || GetNamespaceOfPrefixInScope("xml", null) == null)
341 {
342 return "xml";
343 }
344 }
345 else if ((object)namespaceName == "http://www.w3.org/2000/xmlns/")
346 {
347 return "xmlns";
348 }
349 return null;
350 }
351
352 public static XElement Load(string uri)
353 {
354 return Load(uri, LoadOptions.None);
355 }
356
357 public static XElement Load(string uri, LoadOptions options)
358 {
360 using XmlReader reader = XmlReader.Create(uri, xmlReaderSettings);
361 return Load(reader, options);
362 }
363
364 public static XElement Load(Stream stream)
365 {
366 return Load(stream, LoadOptions.None);
367 }
368
375
383
384 public static XElement Load(TextReader textReader)
385 {
386 return Load(textReader, LoadOptions.None);
387 }
388
389 public static XElement Load(TextReader textReader, LoadOptions options)
390 {
392 using XmlReader reader = XmlReader.Create(textReader, xmlReaderSettings);
393 return Load(reader, options);
394 }
395
403
404 public static XElement Load(XmlReader reader)
405 {
406 return Load(reader, LoadOptions.None);
407 }
408
410 {
411 if (reader == null)
412 {
413 throw new ArgumentNullException("reader");
414 }
415 if (reader.MoveToContent() != XmlNodeType.Element)
416 {
418 }
419 XElement result = new XElement(reader, options);
420 reader.MoveToContent();
421 if (!reader.EOF)
422 {
424 }
425 return result;
426 }
427
429 {
430 if (reader == null)
431 {
432 throw new ArgumentNullException("reader");
433 }
434 if (cancellationToken.IsCancellationRequested)
435 {
437 }
439 }
440
442 {
443 if (await reader.MoveToContentAsync().ConfigureAwait(continueOnCapturedContext: false) != XmlNodeType.Element)
444 {
446 }
447 XElement e = new XElement(default(AsyncConstructionSentry));
449 cancellationToken.ThrowIfCancellationRequested();
450 await reader.MoveToContentAsync().ConfigureAwait(continueOnCapturedContext: false);
451 if (!reader.EOF)
452 {
454 }
455 return e;
456 }
457
458 public static XElement Parse(string text)
459 {
460 return Parse(text, LoadOptions.None);
461 }
462
470
471 public void RemoveAll()
472 {
474 RemoveNodes();
475 }
476
477 public void RemoveAttributes()
478 {
479 if (SkipNotify())
480 {
482 return;
483 }
484 while (lastAttr != null)
485 {
488 if (lastAttr == null || xAttribute != lastAttr.next)
489 {
491 }
492 if (xAttribute != lastAttr)
493 {
495 }
496 else
497 {
498 lastAttr = null;
499 }
500 xAttribute.parent = null;
501 xAttribute.next = null;
503 }
504 }
505
506 public void ReplaceAll(object? content)
507 {
509 RemoveAll();
510 Add(content);
511 }
512
513 public void ReplaceAll(params object?[] content)
514 {
515 ReplaceAll((object?)content);
516 }
517
518 public void ReplaceAttributes(object? content)
519 {
522 Add(content);
523 }
524
525 public void ReplaceAttributes(params object?[] content)
526 {
527 ReplaceAttributes((object?)content);
528 }
529
530 public void Save(Stream stream)
531 {
533 }
534
541
561
566
573
593
594 public void Save(XmlWriter writer)
595 {
596 if (writer == null)
597 {
598 throw new ArgumentNullException("writer");
599 }
600 writer.WriteStartDocument();
602 writer.WriteEndDocument();
603 }
604
606 {
607 if (writer == null)
608 {
609 throw new ArgumentNullException("writer");
610 }
611 if (cancellationToken.IsCancellationRequested)
612 {
614 }
616 }
617
619 {
620 await writer.WriteStartDocumentAsync().ConfigureAwait(continueOnCapturedContext: false);
622 cancellationToken.ThrowIfCancellationRequested();
623 await writer.WriteEndDocumentAsync().ConfigureAwait(continueOnCapturedContext: false);
624 }
625
626 public void SetAttributeValue(XName name, object? value)
627 {
629 if (value == null)
630 {
631 if (xAttribute != null)
632 {
634 }
635 }
636 else if (xAttribute != null)
637 {
639 }
640 else
641 {
643 }
644 }
645
646 public void SetElementValue(XName name, object? value)
647 {
649 if (value == null)
650 {
651 if (xElement != null)
652 {
654 }
655 }
656 else if (xElement != null)
657 {
659 }
660 else
661 {
663 }
664 }
665
666 public void SetValue(object value)
667 {
668 if (value == null)
669 {
670 throw new ArgumentNullException("value");
671 }
673 }
674
675 public override void WriteTo(XmlWriter writer)
676 {
677 if (writer == null)
678 {
679 throw new ArgumentNullException("writer");
680 }
682 }
683
685 {
686 if (writer == null)
687 {
688 throw new ArgumentNullException("writer");
689 }
690 if (cancellationToken.IsCancellationRequested)
691 {
693 }
695 }
696
697 [CLSCompliant(false)]
698 [return: NotNullIfNotNull("element")]
699 public static explicit operator string?(XElement? element)
700 {
701 return element?.Value;
702 }
703
704 [CLSCompliant(false)]
705 public static explicit operator bool(XElement element)
706 {
707 if (element == null)
708 {
709 throw new ArgumentNullException("element");
710 }
711 return XmlConvert.ToBoolean(element.Value.ToLowerInvariant());
712 }
713
714 [CLSCompliant(false)]
715 [return: NotNullIfNotNull("element")]
716 public static explicit operator bool?(XElement? element)
717 {
718 if (element == null)
719 {
720 return null;
721 }
722 return XmlConvert.ToBoolean(element.Value.ToLowerInvariant());
723 }
724
725 [CLSCompliant(false)]
726 public static explicit operator int(XElement element)
727 {
728 if (element == null)
729 {
730 throw new ArgumentNullException("element");
731 }
732 return XmlConvert.ToInt32(element.Value);
733 }
734
735 [CLSCompliant(false)]
736 [return: NotNullIfNotNull("element")]
737 public static explicit operator int?(XElement? element)
738 {
739 if (element == null)
740 {
741 return null;
742 }
743 return XmlConvert.ToInt32(element.Value);
744 }
745
746 [CLSCompliant(false)]
747 public static explicit operator uint(XElement element)
748 {
749 if (element == null)
750 {
751 throw new ArgumentNullException("element");
752 }
753 return XmlConvert.ToUInt32(element.Value);
754 }
755
756 [CLSCompliant(false)]
757 [return: NotNullIfNotNull("element")]
758 public static explicit operator uint?(XElement? element)
759 {
760 if (element == null)
761 {
762 return null;
763 }
764 return XmlConvert.ToUInt32(element.Value);
765 }
766
767 [CLSCompliant(false)]
768 public static explicit operator long(XElement element)
769 {
770 if (element == null)
771 {
772 throw new ArgumentNullException("element");
773 }
774 return XmlConvert.ToInt64(element.Value);
775 }
776
777 [CLSCompliant(false)]
778 [return: NotNullIfNotNull("element")]
779 public static explicit operator long?(XElement? element)
780 {
781 if (element == null)
782 {
783 return null;
784 }
785 return XmlConvert.ToInt64(element.Value);
786 }
787
788 [CLSCompliant(false)]
789 public static explicit operator ulong(XElement element)
790 {
791 if (element == null)
792 {
793 throw new ArgumentNullException("element");
794 }
795 return XmlConvert.ToUInt64(element.Value);
796 }
797
798 [CLSCompliant(false)]
799 [return: NotNullIfNotNull("element")]
800 public static explicit operator ulong?(XElement? element)
801 {
802 if (element == null)
803 {
804 return null;
805 }
806 return XmlConvert.ToUInt64(element.Value);
807 }
808
809 [CLSCompliant(false)]
810 public static explicit operator float(XElement element)
811 {
812 if (element == null)
813 {
814 throw new ArgumentNullException("element");
815 }
816 return XmlConvert.ToSingle(element.Value);
817 }
818
819 [CLSCompliant(false)]
820 [return: NotNullIfNotNull("element")]
821 public static explicit operator float?(XElement? element)
822 {
823 if (element == null)
824 {
825 return null;
826 }
827 return XmlConvert.ToSingle(element.Value);
828 }
829
830 [CLSCompliant(false)]
831 public static explicit operator double(XElement element)
832 {
833 if (element == null)
834 {
835 throw new ArgumentNullException("element");
836 }
837 return XmlConvert.ToDouble(element.Value);
838 }
839
840 [CLSCompliant(false)]
841 [return: NotNullIfNotNull("element")]
842 public static explicit operator double?(XElement? element)
843 {
844 if (element == null)
845 {
846 return null;
847 }
848 return XmlConvert.ToDouble(element.Value);
849 }
850
851 [CLSCompliant(false)]
852 public static explicit operator decimal(XElement element)
853 {
854 if (element == null)
855 {
856 throw new ArgumentNullException("element");
857 }
858 return XmlConvert.ToDecimal(element.Value);
859 }
860
861 [CLSCompliant(false)]
862 [return: NotNullIfNotNull("element")]
863 public static explicit operator decimal?(XElement? element)
864 {
865 if (element == null)
866 {
867 return null;
868 }
869 return XmlConvert.ToDecimal(element.Value);
870 }
871
872 [CLSCompliant(false)]
873 public static explicit operator DateTime(XElement element)
874 {
875 if (element == null)
876 {
877 throw new ArgumentNullException("element");
878 }
879 return DateTime.Parse(element.Value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
880 }
881
882 [CLSCompliant(false)]
883 [return: NotNullIfNotNull("element")]
884 public static explicit operator DateTime?(XElement? element)
885 {
886 if (element == null)
887 {
888 return null;
889 }
890 return DateTime.Parse(element.Value, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind);
891 }
892
893 [CLSCompliant(false)]
894 public static explicit operator DateTimeOffset(XElement element)
895 {
896 if (element == null)
897 {
898 throw new ArgumentNullException("element");
899 }
900 return XmlConvert.ToDateTimeOffset(element.Value);
901 }
902
903 [CLSCompliant(false)]
904 [return: NotNullIfNotNull("element")]
905 public static explicit operator DateTimeOffset?(XElement? element)
906 {
907 if (element == null)
908 {
909 return null;
910 }
911 return XmlConvert.ToDateTimeOffset(element.Value);
912 }
913
914 [CLSCompliant(false)]
915 public static explicit operator TimeSpan(XElement element)
916 {
917 if (element == null)
918 {
919 throw new ArgumentNullException("element");
920 }
921 return XmlConvert.ToTimeSpan(element.Value);
922 }
923
924 [CLSCompliant(false)]
925 [return: NotNullIfNotNull("element")]
926 public static explicit operator TimeSpan?(XElement? element)
927 {
928 if (element == null)
929 {
930 return null;
931 }
932 return XmlConvert.ToTimeSpan(element.Value);
933 }
934
935 [CLSCompliant(false)]
936 public static explicit operator Guid(XElement element)
937 {
938 if (element == null)
939 {
940 throw new ArgumentNullException("element");
941 }
942 return XmlConvert.ToGuid(element.Value);
943 }
944
945 [CLSCompliant(false)]
946 [return: NotNullIfNotNull("element")]
947 public static explicit operator Guid?(XElement? element)
948 {
949 if (element == null)
950 {
951 return null;
952 }
953 return XmlConvert.ToGuid(element.Value);
954 }
955
957 {
958 return null;
959 }
960
962 {
963 if (reader == null)
964 {
965 throw new ArgumentNullException("reader");
966 }
967 if (parent != null || annotations != null || content != null || lastAttr != null)
968 {
970 }
971 if (reader.MoveToContent() != XmlNodeType.Element)
972 {
974 }
975 ReadElementFrom(reader, LoadOptions.None);
976 }
977
982
983 internal override void AddAttribute(XAttribute a)
984 {
985 if (Attribute(a.Name) != null)
986 {
988 }
989 if (a.parent != null)
990 {
991 a = new XAttribute(a);
992 }
994 }
995
996 internal override void AddAttributeSkipNotify(XAttribute a)
997 {
998 if (Attribute(a.Name) != null)
999 {
1001 }
1002 if (a.parent != null)
1003 {
1004 a = new XAttribute(a);
1005 }
1007 }
1008
1010 {
1012 if (a.parent != null)
1013 {
1015 }
1017 if (flag)
1018 {
1020 }
1021 }
1022
1024 {
1025 a.parent = this;
1026 if (lastAttr == null)
1027 {
1028 a.next = a;
1029 }
1030 else
1031 {
1033 lastAttr.next = a;
1034 }
1035 lastAttr = a;
1036 }
1037
1039 {
1042 if (xAttribute != null && xAttribute2 != null)
1043 {
1044 do
1045 {
1046 xAttribute = xAttribute.next;
1047 xAttribute2 = xAttribute2.next;
1048 if (xAttribute.name != xAttribute2.name || xAttribute.value != xAttribute2.value)
1049 {
1050 return false;
1051 }
1052 }
1053 while (xAttribute != lastAttr);
1054 return xAttribute2 == e.lastAttr;
1055 }
1056 if (xAttribute == null)
1057 {
1058 return xAttribute2 == null;
1059 }
1060 return false;
1061 }
1062
1063 internal override XNode CloneNode()
1064 {
1065 return new XElement(this);
1066 }
1067
1068 internal override bool DeepEquals(XNode node)
1069 {
1071 {
1072 return AttributesEqual(xElement);
1073 }
1074 return false;
1075 }
1076
1078 {
1080 if (a == null)
1081 {
1082 yield break;
1083 }
1084 do
1085 {
1086 a = a.next;
1087 if (name == null || a.name == name)
1088 {
1089 yield return a;
1090 }
1091 }
1092 while (a.parent == this && a != lastAttr);
1093 }
1094
1096 {
1098 {
1099 XAttribute xAttribute = xElement.lastAttr;
1100 if (xAttribute != null)
1101 {
1102 do
1103 {
1104 xAttribute = xAttribute.next;
1105 if (xAttribute.IsNamespaceDeclaration && xAttribute.Name.LocalName == prefix)
1106 {
1107 return xAttribute.Value;
1108 }
1109 }
1110 while (xAttribute != xElement.lastAttr);
1111 }
1112 }
1113 return null;
1114 }
1115
1116 internal override int GetDeepHashCode()
1117 {
1118 int hashCode = name.GetHashCode();
1119 hashCode ^= ContentsHashCode();
1121 if (xAttribute != null)
1122 {
1123 do
1124 {
1125 xAttribute = xAttribute.next;
1126 hashCode ^= xAttribute.GetDeepHashCode();
1127 }
1128 while (xAttribute != lastAttr);
1129 }
1130 return hashCode;
1131 }
1132
1134 {
1136 if (!r.IsEmptyElement)
1137 {
1138 r.Read();
1140 }
1141 r.Read();
1142 }
1143
1145 {
1147 if (!r.IsEmptyElement)
1148 {
1149 cancellationTokentoken.ThrowIfCancellationRequested();
1150 await r.ReadAsync().ConfigureAwait(continueOnCapturedContext: false);
1152 }
1153 cancellationTokentoken.ThrowIfCancellationRequested();
1154 await r.ReadAsync().ConfigureAwait(continueOnCapturedContext: false);
1155 }
1156
1158 {
1159 if (r.ReadState != ReadState.Interactive)
1160 {
1162 }
1163 name = XNamespace.Get(r.NamespaceURI).GetName(r.LocalName);
1164 if ((o & LoadOptions.SetBaseUri) != 0)
1165 {
1166 string baseURI = r.BaseURI;
1167 if (!string.IsNullOrEmpty(baseURI))
1168 {
1169 SetBaseUri(baseURI);
1170 }
1171 }
1173 if ((o & LoadOptions.SetLineInfo) != 0)
1174 {
1176 if (xmlLineInfo != null && xmlLineInfo.HasLineInfo())
1177 {
1178 SetLineInfo(xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
1179 }
1180 }
1181 if (!r.MoveToFirstAttribute())
1182 {
1183 return;
1184 }
1185 do
1186 {
1187 XAttribute xAttribute = new XAttribute(XNamespace.Get((r.Prefix.Length == 0) ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value);
1188 if (xmlLineInfo != null && xmlLineInfo.HasLineInfo())
1189 {
1190 xAttribute.SetLineInfo(xmlLineInfo.LineNumber, xmlLineInfo.LinePosition);
1191 }
1193 }
1194 while (r.MoveToNextAttribute());
1195 r.MoveToElement();
1196 }
1197
1199 {
1201 if (a.parent != this)
1202 {
1204 }
1207 while ((xAttribute2 = xAttribute.next) != a)
1208 {
1210 }
1211 if (xAttribute == a)
1212 {
1213 lastAttr = null;
1214 }
1215 else
1216 {
1217 if (lastAttr == a)
1218 {
1220 }
1221 xAttribute.next = a.next;
1222 }
1223 a.parent = null;
1224 a.next = null;
1225 if (flag)
1226 {
1228 }
1229 }
1230
1232 {
1233 if (lastAttr != null)
1234 {
1236 do
1237 {
1239 xAttribute.parent = null;
1240 xAttribute.next = null;
1242 }
1243 while (xAttribute != lastAttr);
1244 lastAttr = null;
1245 }
1246 }
1247
1248 internal void SetEndElementLineInfo(int lineNumber, int linePosition)
1249 {
1250 AddAnnotation(new LineInfoEndElementAnnotation(lineNumber, linePosition));
1251 }
1252
1253 internal override void ValidateNode(XNode node, XNode previous)
1254 {
1255 if (node is XDocument)
1256 {
1258 }
1259 if (node is XDocumentType)
1260 {
1262 }
1263 }
1264}
static CultureInfo InvariantCulture
static string Argument_InvalidPrefix
Definition SR.cs:26
static string InvalidOperation_ExternalCode
Definition SR.cs:50
static string InvalidOperation_ExpectedNodeType
Definition SR.cs:48
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string InvalidOperation_DuplicateAttribute
Definition SR.cs:42
static string InvalidOperation_ExpectedInteractive
Definition SR.cs:46
static string Argument_AddNode
Definition SR.cs:16
static string InvalidOperation_DeserializeInstance
Definition SR.cs:38
static string InvalidOperation_ExpectedEndOfFile
Definition SR.cs:44
Definition SR.cs:7
static string GetStringAndRelease(StringBuilder sb)
static StringBuilder Acquire(int capacity=16)
static Task FromCanceled(CancellationToken cancellationToken)
Definition Task.cs:3363
static IEnumerable< XAttribute > EmptySequence
Definition XAttribute.cs:18
void AddContentSkipNotify(object content)
bool ContentsEqual(XContainer e)
static object GetContentSnapshot(object content)
async Task ReadContentFromAsync(XmlReader r, CancellationToken cancellationToken)
void ReadContentFrom(XmlReader r)
IEnumerable< XNode > GetDescendantNodes(bool self)
static string GetStringValue(object value)
IEnumerable< XElement > GetDescendants(XName name, bool self)
override void AppendText(StringBuilder sb)
IEnumerable< XAttribute > Attributes()
Definition XElement.cs:236
static XElement Load(Stream stream)
Definition XElement.cs:364
void Save(string fileName)
Definition XElement.cs:192
IEnumerable< XElement > DescendantsAndSelf()
Definition XElement.cs:255
static XElement Load(TextReader textReader)
Definition XElement.cs:384
override void AddAttributeSkipNotify(XAttribute a)
Definition XElement.cs:996
XAttribute? Attribute(XName name)
Definition XElement.cs:218
bool AttributesEqual(XElement e)
Definition XElement.cs:1038
string? GetPrefixOfNamespace(XNamespace ns)
Definition XElement.cs:305
override void ValidateNode(XNode node, XNode previous)
Definition XElement.cs:1253
static async Task< XElement > LoadAsync(TextReader textReader, LoadOptions options, CancellationToken cancellationToken)
Definition XElement.cs:396
void ReplaceAttributes(params object?[] content)
Definition XElement.cs:525
override void AddAttribute(XAttribute a)
Definition XElement.cs:983
IEnumerable< XElement > AncestorsAndSelf(XName? name)
Definition XElement.cs:209
void AppendAttribute(XAttribute a)
Definition XElement.cs:1009
void Save(Stream stream, SaveOptions options)
Definition XElement.cs:535
override int GetDeepHashCode()
Definition XElement.cs:1116
XElement(XmlReader r, LoadOptions o)
Definition XElement.cs:180
override bool DeepEquals(XNode node)
Definition XElement.cs:1068
async Task ReadElementFromAsync(XmlReader r, LoadOptions o, CancellationToken cancellationTokentoken)
Definition XElement.cs:1144
override XmlNodeType NodeType
Definition XElement.cs:91
void SetElementValue(XName name, object? value)
Definition XElement.cs:646
XNamespace? GetNamespaceOfPrefix(string prefix)
Definition XElement.cs:279
static XElement Load(string uri)
Definition XElement.cs:352
IEnumerable< XElement > DescendantsAndSelf(XName? name)
Definition XElement.cs:260
string GetNamespaceOfPrefixInScope(string prefix, XElement outOfScope)
Definition XElement.cs:1095
XElement(XStreamingElement other)
Definition XElement.cs:156
void ReplaceAll(object? content)
Definition XElement.cs:506
static XElement Load(string uri, LoadOptions options)
Definition XElement.cs:357
XAttribute? FirstAttribute
Definition XElement.cs:32
XNamespace GetDefaultNamespace()
Definition XElement.cs:269
XElement(XElement other)
Definition XElement.cs:140
static XElement Load(XmlReader reader, LoadOptions options)
Definition XElement.cs:409
IEnumerable< XAttribute > Attributes(XName? name)
Definition XElement.cs:241
void ReadElementFrom(XmlReader r, LoadOptions o)
Definition XElement.cs:1133
override Task WriteToAsync(XmlWriter writer, CancellationToken cancellationToken)
Definition XElement.cs:684
async Task SaveAsync(TextWriter textWriter, SaveOptions options, CancellationToken cancellationToken)
Definition XElement.cs:574
static XElement Load(XmlReader reader)
Definition XElement.cs:404
IEnumerable< XAttribute > GetAttributes(XName name)
Definition XElement.cs:1077
IEnumerable< XElement > AncestorsAndSelf()
Definition XElement.cs:204
void Save(XmlWriter writer)
Definition XElement.cs:594
void ReplaceAll(params object?[] content)
Definition XElement.cs:513
void SetEndElementLineInfo(int lineNumber, int linePosition)
Definition XElement.cs:1248
XAttribute? LastAttribute
Definition XElement.cs:68
XElement(XmlReader r)
Definition XElement.cs:171
void Save(TextWriter textWriter, SaveOptions options)
Definition XElement.cs:567
async Task SaveAsyncInternal(XmlWriter writer, CancellationToken cancellationToken)
Definition XElement.cs:618
void SetValue(object value)
Definition XElement.cs:666
static XElement Parse(string text)
Definition XElement.cs:458
XElement(XName name, params object?[] content)
Definition XElement.cs:135
void AppendAttributeSkipNotify(XAttribute a)
Definition XElement.cs:1023
static XElement Load(TextReader textReader, LoadOptions options)
Definition XElement.cs:389
static Task< XElement > LoadAsync(XmlReader reader, LoadOptions options, CancellationToken cancellationToken)
Definition XElement.cs:428
override XNode CloneNode()
Definition XElement.cs:1063
static async Task< XElement > LoadAsyncInternal(XmlReader reader, LoadOptions options, CancellationToken cancellationToken)
Definition XElement.cs:441
async Task SaveAsync(Stream stream, SaveOptions options, CancellationToken cancellationToken)
Definition XElement.cs:542
void SetAttributeValue(XName name, object? value)
Definition XElement.cs:626
static IEnumerable< XElement > EmptySequence
Definition XElement.cs:29
static XElement Parse(string text, LoadOptions options)
Definition XElement.cs:463
void Save(string fileName, SaveOptions options)
Definition XElement.cs:197
static async Task< XElement > CreateAsync(XmlReader r, CancellationToken cancellationToken)
Definition XElement.cs:185
override void WriteTo(XmlWriter writer)
Definition XElement.cs:675
XElement(AsyncConstructionSentry s)
Definition XElement.cs:176
void ReadElementFromImpl(XmlReader r, LoadOptions o)
Definition XElement.cs:1157
Task SaveAsync(XmlWriter writer, CancellationToken cancellationToken)
Definition XElement.cs:605
void Save(TextWriter textWriter)
Definition XElement.cs:562
static async Task< XElement > LoadAsync(Stream stream, LoadOptions options, CancellationToken cancellationToken)
Definition XElement.cs:376
void ReplaceAttributes(object? content)
Definition XElement.cs:518
XElement(XName name, object? content)
Definition XElement.cs:129
void RemoveAttribute(XAttribute a)
Definition XElement.cs:1198
static XElement Load(Stream stream, LoadOptions options)
Definition XElement.cs:369
void Save(Stream stream)
Definition XElement.cs:530
IEnumerable< XNode > DescendantNodesAndSelf()
Definition XElement.cs:250
override int GetHashCode()
Definition XName.cs:79
static XNamespace Xmlns
Definition XNamespace.cs:28
static XNamespace Get(string namespaceName)
Definition XNamespace.cs:51
static XNamespace None
Definition XNamespace.cs:24
static XNamespace Xml
Definition XNamespace.cs:26
static XmlWriterSettings GetXmlWriterSettings(SaveOptions o)
Definition XNode.cs:512
IEnumerable< XElement > GetAncestors(XName name, bool self)
Definition XNode.cs:451
static XmlReaderSettings GetXmlReaderSettings(LoadOptions o)
Definition XNode.cs:500
static readonly XObjectChangeEventArgs Name
static readonly XObjectChangeEventArgs Add
static readonly XObjectChangeEventArgs Remove
XContainer parent
Definition XObject.cs:7
bool NotifyChanging(object sender, XObjectChangeEventArgs e)
Definition XObject.cs:428
SaveOptions GetSaveOptionsFromAnnotations()
Definition XObject.cs:490
void AddAnnotation(object annotation)
Definition XObject.cs:133
bool NotifyChanged(object sender, XObjectChangeEventArgs e)
Definition XObject.cs:399
static bool ToBoolean(string s)
static DateTimeOffset ToDateTimeOffset(string s)
static uint ToUInt32(string s)
static int ToInt32(string s)
static float ToSingle(string s)
static TimeSpan ToTimeSpan(string s)
static double ToDouble(string s)
static Guid ToGuid(string s)
static decimal ToDecimal(string s)
static ulong ToUInt64(string s)
static long ToInt64(string s)
virtual async Task< XmlNodeType > MoveToContentAsync()
virtual XmlNodeType MoveToContent()
Definition XmlReader.cs:604
XmlNodeType NodeType
Definition XmlReader.cs:62
static XmlReader Create(string inputUri)
static XmlWriter Create(string outputFileName)
Definition XmlWriter.cs:468
static DateTime Parse(string s)
Definition DateTime.cs:919
async Task WriteElementAsync(XElement e, CancellationToken cancellationToken)