Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XPathNavigator.cs
Go to the documentation of this file.
6using System.IO;
7using System.Text;
10
11namespace System.Xml.XPath;
12
13[DebuggerDisplay("{debuggerDisplayProxy}")]
15{
16 private sealed class CheckValidityHelper
17 {
18 private bool _isValid;
19
20 private readonly ValidationEventHandler _nextEventHandler;
21
22 private readonly XPathNavigatorReader _reader;
23
24 internal bool IsValid => _isValid;
25
26 internal CheckValidityHelper(ValidationEventHandler nextEventHandler, XPathNavigatorReader reader)
27 {
28 _isValid = true;
30 _reader = reader;
31 }
32
33 internal void ValidationCallback(object sender, ValidationEventArgs args)
34 {
35 if (args.Severity == XmlSeverityType.Error)
36 {
37 _isValid = false;
38 }
40 if (ex != null && _reader != null)
41 {
42 ex.SetSourceObject(_reader.UnderlyingObject);
43 }
44 if (_nextEventHandler != null)
45 {
46 _nextEventHandler(sender, args);
47 }
48 else if (ex != null && args.Severity == XmlSeverityType.Error)
49 {
50 throw ex;
51 }
52 }
53 }
54
55 [DebuggerDisplay("{ToString()}")]
56 internal struct DebuggerDisplayProxy
57 {
58 private readonly XPathNavigator _nav;
59
61 {
62 _nav = nav;
63 }
64
65 public override string ToString()
66 {
67 string text = _nav.NodeType.ToString();
68 switch (_nav.NodeType)
69 {
70 case XPathNodeType.Element:
71 text = text + ", Name=\"" + _nav.Name + "\"";
72 break;
73 case XPathNodeType.Attribute:
74 case XPathNodeType.Namespace:
75 case XPathNodeType.ProcessingInstruction:
76 text = text + ", Name=\"" + _nav.Name + "\"";
78 break;
79 case XPathNodeType.Text:
80 case XPathNodeType.SignificantWhitespace:
81 case XPathNodeType.Whitespace:
82 case XPathNodeType.Comment:
84 break;
85 }
86 return text;
87 }
88 }
89
91
92 internal static readonly char[] NodeTypeLetter = new char[10] { 'R', 'E', 'A', 'N', 'T', 'S', 'W', 'P', 'C', 'X' };
93
94 internal static readonly char[] UniqueIdTbl = new char[32]
95 {
96 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
97 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
98 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4',
99 '5', '6'
100 };
101
102 internal static readonly int[] ContentKindMasks = new int[10] { 1, 2, 0, 0, 112, 32, 64, 128, 256, 2147483635 };
103
104 public sealed override bool IsNode => true;
105
106 public override XmlSchemaType? XmlType
107 {
108 get
109 {
110 IXmlSchemaInfo schemaInfo = SchemaInfo;
111 if (schemaInfo != null && schemaInfo.Validity == XmlSchemaValidity.Valid)
112 {
114 if (memberType != null)
115 {
116 return memberType;
117 }
118 return schemaInfo.SchemaType;
119 }
120 return null;
121 }
122 }
123
124 public override object TypedValue
125 {
126 get
127 {
128 IXmlSchemaInfo schemaInfo = SchemaInfo;
129 if (schemaInfo != null)
130 {
131 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
132 {
134 if (xmlSchemaType == null)
135 {
136 xmlSchemaType = schemaInfo.SchemaType;
137 }
138 if (xmlSchemaType != null)
139 {
140 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
141 if (datatype != null)
142 {
143 return xmlSchemaType.ValueConverter.ChangeType(Value, datatype.ValueType, this);
144 }
145 }
146 }
147 else
148 {
150 if (xmlSchemaType != null)
151 {
152 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
153 if (datatype != null)
154 {
155 return xmlSchemaType.ValueConverter.ChangeType(datatype.ParseValue(Value, NameTable, this), datatype.ValueType, this);
156 }
157 }
158 }
159 }
160 return Value;
161 }
162 }
163
164 public override Type ValueType
165 {
166 get
167 {
168 IXmlSchemaInfo schemaInfo = SchemaInfo;
169 if (schemaInfo != null)
170 {
171 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
172 {
174 if (xmlSchemaType == null)
175 {
176 xmlSchemaType = schemaInfo.SchemaType;
177 }
178 if (xmlSchemaType != null)
179 {
180 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
181 if (datatype != null)
182 {
183 return datatype.ValueType;
184 }
185 }
186 }
187 else
188 {
190 if (xmlSchemaType != null)
191 {
192 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
193 if (datatype != null)
194 {
195 return datatype.ValueType;
196 }
197 }
198 }
199 }
200 return typeof(string);
201 }
202 }
203
204 public override bool ValueAsBoolean
205 {
206 get
207 {
208 IXmlSchemaInfo schemaInfo = SchemaInfo;
209 if (schemaInfo != null)
210 {
211 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
212 {
214 if (xmlSchemaType == null)
215 {
216 xmlSchemaType = schemaInfo.SchemaType;
217 }
218 if (xmlSchemaType != null)
219 {
220 return xmlSchemaType.ValueConverter.ToBoolean(Value);
221 }
222 }
223 else
224 {
226 if (xmlSchemaType != null)
227 {
228 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
229 if (datatype != null)
230 {
231 return xmlSchemaType.ValueConverter.ToBoolean(datatype.ParseValue(Value, NameTable, this));
232 }
233 }
234 }
235 }
236 return XmlUntypedConverter.Untyped.ToBoolean(Value);
237 }
238 }
239
240 public override DateTime ValueAsDateTime
241 {
242 get
243 {
244 IXmlSchemaInfo schemaInfo = SchemaInfo;
245 if (schemaInfo != null)
246 {
247 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
248 {
250 if (xmlSchemaType == null)
251 {
252 xmlSchemaType = schemaInfo.SchemaType;
253 }
254 if (xmlSchemaType != null)
255 {
256 return xmlSchemaType.ValueConverter.ToDateTime(Value);
257 }
258 }
259 else
260 {
262 if (xmlSchemaType != null)
263 {
264 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
265 if (datatype != null)
266 {
267 return xmlSchemaType.ValueConverter.ToDateTime(datatype.ParseValue(Value, NameTable, this));
268 }
269 }
270 }
271 }
272 return XmlUntypedConverter.Untyped.ToDateTime(Value);
273 }
274 }
275
276 public override double ValueAsDouble
277 {
278 get
279 {
280 IXmlSchemaInfo schemaInfo = SchemaInfo;
281 if (schemaInfo != null)
282 {
283 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
284 {
286 if (xmlSchemaType == null)
287 {
288 xmlSchemaType = schemaInfo.SchemaType;
289 }
290 if (xmlSchemaType != null)
291 {
292 return xmlSchemaType.ValueConverter.ToDouble(Value);
293 }
294 }
295 else
296 {
298 if (xmlSchemaType != null)
299 {
300 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
301 if (datatype != null)
302 {
303 return xmlSchemaType.ValueConverter.ToDouble(datatype.ParseValue(Value, NameTable, this));
304 }
305 }
306 }
307 }
308 return XmlUntypedConverter.Untyped.ToDouble(Value);
309 }
310 }
311
312 public override int ValueAsInt
313 {
314 get
315 {
316 IXmlSchemaInfo schemaInfo = SchemaInfo;
317 if (schemaInfo != null)
318 {
319 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
320 {
322 if (xmlSchemaType == null)
323 {
324 xmlSchemaType = schemaInfo.SchemaType;
325 }
326 if (xmlSchemaType != null)
327 {
328 return xmlSchemaType.ValueConverter.ToInt32(Value);
329 }
330 }
331 else
332 {
334 if (xmlSchemaType != null)
335 {
336 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
337 if (datatype != null)
338 {
339 return xmlSchemaType.ValueConverter.ToInt32(datatype.ParseValue(Value, NameTable, this));
340 }
341 }
342 }
343 }
344 return XmlUntypedConverter.Untyped.ToInt32(Value);
345 }
346 }
347
348 public override long ValueAsLong
349 {
350 get
351 {
352 IXmlSchemaInfo schemaInfo = SchemaInfo;
353 if (schemaInfo != null)
354 {
355 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
356 {
358 if (xmlSchemaType == null)
359 {
360 xmlSchemaType = schemaInfo.SchemaType;
361 }
362 if (xmlSchemaType != null)
363 {
364 return xmlSchemaType.ValueConverter.ToInt64(Value);
365 }
366 }
367 else
368 {
370 if (xmlSchemaType != null)
371 {
372 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
373 if (datatype != null)
374 {
375 return xmlSchemaType.ValueConverter.ToInt64(datatype.ParseValue(Value, NameTable, this));
376 }
377 }
378 }
379 }
380 return XmlUntypedConverter.Untyped.ToInt64(Value);
381 }
382 }
383
384 public abstract XmlNameTable NameTable { get; }
385
387
388 public abstract XPathNodeType NodeType { get; }
389
390 public abstract string LocalName { get; }
391
392 public abstract string Name { get; }
393
394 public abstract string NamespaceURI { get; }
395
396 public abstract string Prefix { get; }
397
398 public abstract string BaseURI { get; }
399
400 public abstract bool IsEmptyElement { get; }
401
402 public virtual string XmlLang
403 {
404 get
405 {
407 do
408 {
409 if (xPathNavigator.MoveToAttribute("lang", "http://www.w3.org/XML/1998/namespace"))
410 {
411 return xPathNavigator.Value;
412 }
413 }
414 while (xPathNavigator.MoveToParent());
415 return string.Empty;
416 }
417 }
418
419 public virtual object? UnderlyingObject => null;
420
421 public virtual bool HasAttributes
422 {
423 get
424 {
426 {
427 return false;
428 }
429 MoveToParent();
430 return true;
431 }
432 }
433
434 public virtual bool HasChildren
435 {
436 get
437 {
438 if (MoveToFirstChild())
439 {
440 MoveToParent();
441 return true;
442 }
443 return false;
444 }
445 }
446
448
449 public virtual bool CanEdit => false;
450
451 public virtual string OuterXml
452 {
453 get
454 {
455 if (NodeType == XPathNodeType.Attribute)
456 {
457 return Name + "=\"" + Value + "\"";
458 }
459 if (NodeType == XPathNodeType.Namespace)
460 {
461 if (LocalName.Length == 0)
462 {
463 return "xmlns=\"" + Value + "\"";
464 }
465 return "xmlns:" + LocalName + "=\"" + Value + "\"";
466 }
473 try
474 {
475 xmlWriter.WriteNode(this, defattr: true);
476 }
477 finally
478 {
479 xmlWriter.Close();
480 }
481 return stringWriter.ToString();
482 }
483 set
484 {
486 }
487 }
488
489 public virtual string InnerXml
490 {
491 get
492 {
493 switch (NodeType)
494 {
495 case XPathNodeType.Root:
496 case XPathNodeType.Element:
497 {
504 try
505 {
506 if (MoveToFirstChild())
507 {
508 do
509 {
510 xmlWriter.WriteNode(this, defattr: true);
511 }
512 while (MoveToNext());
513 MoveToParent();
514 }
515 }
516 finally
517 {
518 xmlWriter.Close();
519 }
520 return stringWriter.ToString();
521 }
522 case XPathNodeType.Attribute:
523 case XPathNodeType.Namespace:
524 return Value;
525 default:
526 return string.Empty;
527 }
528 }
529 set
530 {
531 if (value == null)
532 {
533 throw new ArgumentNullException("value");
534 }
535 switch (NodeType)
536 {
537 case XPathNodeType.Root:
538 case XPathNodeType.Element:
539 {
541 while (xPathNavigator.MoveToFirstChild())
542 {
543 xPathNavigator.DeleteSelf();
544 }
545 if (value.Length != 0)
546 {
547 xPathNavigator.AppendChild(value);
548 }
549 break;
550 }
551 case XPathNodeType.Attribute:
553 break;
554 default:
556 }
557 }
558 }
559
560 internal uint IndexInParent
561 {
562 get
563 {
565 uint num = 0u;
566 XPathNodeType nodeType = NodeType;
567 if (nodeType != XPathNodeType.Attribute)
568 {
569 if (nodeType == XPathNodeType.Namespace)
570 {
571 while (xPathNavigator.MoveToNextNamespace())
572 {
573 num++;
574 }
575 }
576 else
577 {
578 while (xPathNavigator.MoveToNext())
579 {
580 num++;
581 }
582 }
583 }
584 else
585 {
586 while (xPathNavigator.MoveToNextAttribute())
587 {
588 num++;
589 }
590 }
591 return num;
592 }
593 }
594
595 internal virtual string UniqueId
596 {
597 get
598 {
602 while (true)
603 {
604 uint num = xPathNavigator.IndexInParent;
605 if (!xPathNavigator.MoveToParent())
606 {
607 break;
608 }
609 if (num <= 31)
610 {
611 stringBuilder.Append(UniqueIdTbl[num]);
612 continue;
613 }
614 stringBuilder.Append('0');
615 do
616 {
617 stringBuilder.Append(UniqueIdTbl[num & 0x1F]);
618 num >>= 5;
619 }
620 while (num != 0);
621 stringBuilder.Append('0');
622 }
623 return stringBuilder.ToString();
624 }
625 }
626
627 private object debuggerDisplayProxy => new DebuggerDisplayProxy(this);
628
629 public override string ToString()
630 {
631 return Value;
632 }
633
634 public virtual void SetValue(string value)
635 {
636 throw new NotSupportedException();
637 }
638
639 public virtual void SetTypedValue(object typedValue)
640 {
641 if (typedValue == null)
642 {
643 throw new ArgumentNullException("typedValue");
644 }
645 XPathNodeType nodeType = NodeType;
646 if ((uint)(nodeType - 1) > 1u)
647 {
649 }
650 string text = null;
651 IXmlSchemaInfo schemaInfo = SchemaInfo;
652 if (schemaInfo != null)
653 {
654 XmlSchemaType schemaType = schemaInfo.SchemaType;
655 if (schemaType != null)
656 {
657 text = schemaType.ValueConverter.ToString(typedValue, this);
658 schemaType.Datatype?.ParseValue(text, NameTable, this);
659 }
660 }
661 if (text == null)
662 {
663 text = XmlUntypedConverter.Untyped.ToString(typedValue, this);
664 }
665 SetValue(text);
666 }
667
669 {
670 if (nsResolver == null)
671 {
672 nsResolver = this;
673 }
674 IXmlSchemaInfo schemaInfo = SchemaInfo;
675 if (schemaInfo != null)
676 {
677 if (schemaInfo.Validity == XmlSchemaValidity.Valid)
678 {
680 if (xmlSchemaType == null)
681 {
682 xmlSchemaType = schemaInfo.SchemaType;
683 }
684 if (xmlSchemaType != null)
685 {
686 return xmlSchemaType.ValueConverter.ChangeType(Value, returnType, nsResolver);
687 }
688 }
689 else
690 {
692 if (xmlSchemaType != null)
693 {
694 XmlSchemaDatatype datatype = xmlSchemaType.Datatype;
695 if (datatype != null)
696 {
697 return xmlSchemaType.ValueConverter.ChangeType(datatype.ParseValue(Value, NameTable, nsResolver), returnType, nsResolver);
698 }
699 }
700 }
701 }
703 }
704
706 {
707 return Clone();
708 }
709
711 {
712 return Clone();
713 }
714
715 public virtual string? LookupNamespace(string prefix)
716 {
717 if (prefix == null)
718 {
719 return null;
720 }
721 if (NodeType != XPathNodeType.Element)
722 {
724 if (xPathNavigator.MoveToParent())
725 {
726 return xPathNavigator.LookupNamespace(prefix);
727 }
728 }
729 else if (MoveToNamespace(prefix))
730 {
731 string value = Value;
732 MoveToParent();
733 return value;
734 }
735 if (prefix.Length == 0)
736 {
737 return string.Empty;
738 }
739 if (prefix == "xml")
740 {
741 return "http://www.w3.org/XML/1998/namespace";
742 }
743 if (prefix == "xmlns")
744 {
745 return "http://www.w3.org/2000/xmlns/";
746 }
747 return null;
748 }
749
750 public virtual string? LookupPrefix(string namespaceURI)
751 {
752 if (namespaceURI == null)
753 {
754 return null;
755 }
757 if (NodeType != XPathNodeType.Element)
758 {
759 if (xPathNavigator.MoveToParent())
760 {
761 return xPathNavigator.LookupPrefix(namespaceURI);
762 }
763 }
764 else if (xPathNavigator.MoveToFirstNamespace(XPathNamespaceScope.All))
765 {
766 do
767 {
768 if (namespaceURI == xPathNavigator.Value)
769 {
770 return xPathNavigator.LocalName;
771 }
772 }
773 while (xPathNavigator.MoveToNextNamespace(XPathNamespaceScope.All));
774 }
775 if (namespaceURI == LookupNamespace(string.Empty))
776 {
777 return string.Empty;
778 }
779 if (namespaceURI == "http://www.w3.org/XML/1998/namespace")
780 {
781 return "xml";
782 }
783 if (namespaceURI == "http://www.w3.org/2000/xmlns/")
784 {
785 return "xmlns";
786 }
787 return null;
788 }
789
791 {
792 XPathNodeType nodeType = NodeType;
793 if ((nodeType != XPathNodeType.Element && scope != XmlNamespaceScope.Local) || nodeType == XPathNodeType.Attribute || nodeType == XPathNodeType.Namespace)
794 {
796 if (xPathNavigator.MoveToParent())
797 {
798 return xPathNavigator.GetNamespacesInScope(scope);
799 }
800 }
802 if (scope == XmlNamespaceScope.All)
803 {
804 dictionary["xml"] = "http://www.w3.org/XML/1998/namespace";
805 }
807 {
808 do
809 {
810 string localName = LocalName;
811 string value = Value;
812 if (localName.Length != 0 || value.Length != 0 || scope == XmlNamespaceScope.Local)
813 {
814 dictionary[localName] = value;
815 }
816 }
818 MoveToParent();
819 }
820 return dictionary;
821 }
822
823 public abstract XPathNavigator Clone();
824
825 public virtual XmlReader ReadSubtree()
826 {
827 XPathNodeType nodeType = NodeType;
828 if ((uint)nodeType > 1u)
829 {
831 }
832 return CreateReader();
833 }
834
835 public virtual void WriteSubtree(XmlWriter writer)
836 {
837 if (writer == null)
838 {
839 throw new ArgumentNullException("writer");
840 }
841 writer.WriteNode(this, defattr: true);
842 }
843
844 public virtual string GetAttribute(string localName, string namespaceURI)
845 {
846 if (!MoveToAttribute(localName, namespaceURI))
847 {
848 return "";
849 }
850 string value = Value;
851 MoveToParent();
852 return value;
853 }
854
855 public virtual bool MoveToAttribute(string localName, string namespaceURI)
856 {
858 {
859 do
860 {
861 if (localName == LocalName && namespaceURI == NamespaceURI)
862 {
863 return true;
864 }
865 }
866 while (MoveToNextAttribute());
867 MoveToParent();
868 }
869 return false;
870 }
871
872 public abstract bool MoveToFirstAttribute();
873
874 public abstract bool MoveToNextAttribute();
875
876 public virtual string GetNamespace(string name)
877 {
878 if (!MoveToNamespace(name))
879 {
880 if (name == "xml")
881 {
882 return "http://www.w3.org/XML/1998/namespace";
883 }
884 if (name == "xmlns")
885 {
886 return "http://www.w3.org/2000/xmlns/";
887 }
888 return string.Empty;
889 }
890 string value = Value;
891 MoveToParent();
892 return value;
893 }
894
895 public virtual bool MoveToNamespace(string name)
896 {
898 {
899 do
900 {
901 if (name == LocalName)
902 {
903 return true;
904 }
905 }
907 MoveToParent();
908 }
909 return false;
910 }
911
913
915
917 {
919 }
920
922 {
924 }
925
926 public abstract bool MoveToNext();
927
928 public abstract bool MoveToPrevious();
929
930 public virtual bool MoveToFirst()
931 {
932 XPathNodeType nodeType = NodeType;
933 if ((uint)(nodeType - 2) <= 1u)
934 {
935 return false;
936 }
937 if (!MoveToParent())
938 {
939 return false;
940 }
941 return MoveToFirstChild();
942 }
943
944 public abstract bool MoveToFirstChild();
945
946 public abstract bool MoveToParent();
947
948 public virtual void MoveToRoot()
949 {
950 while (MoveToParent())
951 {
952 }
953 }
954
955 public abstract bool MoveTo(XPathNavigator other);
956
957 public abstract bool MoveToId(string id);
958
959 public virtual bool MoveToChild(string localName, string namespaceURI)
960 {
961 if (MoveToFirstChild())
962 {
963 do
964 {
965 if (NodeType == XPathNodeType.Element && localName == LocalName && namespaceURI == NamespaceURI)
966 {
967 return true;
968 }
969 }
970 while (MoveToNext());
971 MoveToParent();
972 }
973 return false;
974 }
975
976 public virtual bool MoveToChild(XPathNodeType type)
977 {
978 if (MoveToFirstChild())
979 {
981 do
982 {
983 if (((1 << (int)NodeType) & contentKindMask) != 0)
984 {
985 return true;
986 }
987 }
988 while (MoveToNext());
989 MoveToParent();
990 }
991 return false;
992 }
993
994 public virtual bool MoveToFollowing(string localName, string namespaceURI)
995 {
996 return MoveToFollowing(localName, namespaceURI, null);
997 }
998
999 public virtual bool MoveToFollowing(string localName, string namespaceURI, XPathNavigator? end)
1000 {
1002 if (end != null)
1003 {
1004 XPathNodeType nodeType = end.NodeType;
1005 if ((uint)(nodeType - 2) <= 1u)
1006 {
1007 end = end.Clone();
1008 end.MoveToNonDescendant();
1009 }
1010 }
1012 if ((uint)(nodeType2 - 2) <= 1u && !MoveToParent())
1013 {
1014 return false;
1015 }
1016 do
1017 {
1018 if (!MoveToFirstChild())
1019 {
1020 while (!MoveToNext())
1021 {
1022 if (!MoveToParent())
1023 {
1024 MoveTo(other);
1025 return false;
1026 }
1027 }
1028 }
1029 if (end != null && IsSamePosition(end))
1030 {
1031 MoveTo(other);
1032 return false;
1033 }
1034 }
1035 while (NodeType != XPathNodeType.Element || localName != LocalName || namespaceURI != NamespaceURI);
1036 return true;
1037 }
1038
1040 {
1041 return MoveToFollowing(type, null);
1042 }
1043
1045 {
1048 if (end != null)
1049 {
1050 XPathNodeType nodeType = end.NodeType;
1051 if ((uint)(nodeType - 2) <= 1u)
1052 {
1053 end = end.Clone();
1054 end.MoveToNonDescendant();
1055 }
1056 }
1058 if ((uint)(nodeType2 - 2) <= 1u && !MoveToParent())
1059 {
1060 return false;
1061 }
1062 do
1063 {
1064 if (!MoveToFirstChild())
1065 {
1066 while (!MoveToNext())
1067 {
1068 if (!MoveToParent())
1069 {
1070 MoveTo(other);
1071 return false;
1072 }
1073 }
1074 }
1075 if (end != null && IsSamePosition(end))
1076 {
1077 MoveTo(other);
1078 return false;
1079 }
1080 }
1081 while (((1 << (int)NodeType) & contentKindMask) == 0);
1082 return true;
1083 }
1084
1085 public virtual bool MoveToNext(string localName, string namespaceURI)
1086 {
1088 while (MoveToNext())
1089 {
1090 if (NodeType == XPathNodeType.Element && localName == LocalName && namespaceURI == NamespaceURI)
1091 {
1092 return true;
1093 }
1094 }
1095 MoveTo(other);
1096 return false;
1097 }
1098
1099 public virtual bool MoveToNext(XPathNodeType type)
1100 {
1103 while (MoveToNext())
1104 {
1105 if (((1 << (int)NodeType) & contentKindMask) != 0)
1106 {
1107 return true;
1108 }
1109 }
1110 MoveTo(other);
1111 return false;
1112 }
1113
1114 public abstract bool IsSamePosition(XPathNavigator other);
1115
1116 public virtual bool IsDescendant([NotNullWhen(true)] XPathNavigator? nav)
1117 {
1118 if (nav != null)
1119 {
1120 nav = nav.Clone();
1121 while (nav.MoveToParent())
1122 {
1123 if (nav.IsSamePosition(this))
1124 {
1125 return true;
1126 }
1127 }
1128 }
1129 return false;
1130 }
1131
1133 {
1134 if (nav == null)
1135 {
1136 return XmlNodeOrder.Unknown;
1137 }
1138 if (IsSamePosition(nav))
1139 {
1140 return XmlNodeOrder.Same;
1141 }
1144 int num = GetDepth(xPathNavigator.Clone());
1145 int num2 = GetDepth(xPathNavigator2.Clone());
1146 if (num > num2)
1147 {
1148 while (num > num2)
1149 {
1150 xPathNavigator.MoveToParent();
1151 num--;
1152 }
1153 if (xPathNavigator.IsSamePosition(xPathNavigator2))
1154 {
1155 return XmlNodeOrder.After;
1156 }
1157 }
1158 if (num2 > num)
1159 {
1160 while (num2 > num)
1161 {
1162 xPathNavigator2.MoveToParent();
1163 num2--;
1164 }
1165 if (xPathNavigator.IsSamePosition(xPathNavigator2))
1166 {
1167 return XmlNodeOrder.Before;
1168 }
1169 }
1172 while (true)
1173 {
1174 if (!xPathNavigator3.MoveToParent() || !xPathNavigator4.MoveToParent())
1175 {
1176 return XmlNodeOrder.Unknown;
1177 }
1178 if (xPathNavigator3.IsSamePosition(xPathNavigator4))
1179 {
1180 break;
1181 }
1182 xPathNavigator.MoveToParent();
1183 xPathNavigator2.MoveToParent();
1184 }
1185 _ = xPathNavigator.GetType().ToString() != "Microsoft.VisualStudio.Modeling.StoreNavigator";
1187 }
1188
1189 public virtual bool CheckValidity(XmlSchemaSet schemas, ValidationEventHandler validationEventHandler)
1190 {
1194 switch (NodeType)
1195 {
1196 case XPathNodeType.Root:
1197 if (schemas == null)
1198 {
1200 }
1201 xmlSchemaType = null;
1202 break;
1203 case XPathNodeType.Element:
1204 {
1205 if (schemas == null)
1206 {
1208 }
1209 IXmlSchemaInfo schemaInfo = SchemaInfo;
1210 if (schemaInfo != null)
1211 {
1212 xmlSchemaType = schemaInfo.SchemaType;
1213 xmlSchemaElement = schemaInfo.SchemaElement;
1214 }
1215 if (xmlSchemaType == null && xmlSchemaElement == null)
1216 {
1218 }
1219 break;
1220 }
1221 case XPathNodeType.Attribute:
1222 {
1223 if (schemas == null)
1224 {
1226 }
1227 IXmlSchemaInfo schemaInfo = SchemaInfo;
1228 if (schemaInfo != null)
1229 {
1230 xmlSchemaType = schemaInfo.SchemaType;
1232 }
1233 if (xmlSchemaType == null && xmlSchemaAttribute == null)
1234 {
1236 }
1237 break;
1238 }
1239 default:
1241 }
1243 CheckValidityHelper checkValidityHelper = new CheckValidityHelper(validationEventHandler, reader);
1244 validationEventHandler = checkValidityHelper.ValidationCallback;
1246 while (validatingReader.Read())
1247 {
1248 }
1249 return checkValidityHelper.IsValid;
1250 }
1251
1253 {
1254 if (schemaAttribute != null)
1255 {
1256 return schemaAttribute.Validate(reader, null, schemas, validationEvent);
1257 }
1258 if (schemaElement != null)
1259 {
1260 return schemaElement.Validate(reader, null, schemas, validationEvent);
1261 }
1262 if (schemaType != null)
1263 {
1264 return schemaType.Validate(reader, null, schemas, validationEvent);
1265 }
1269 xmlReaderSettings.Schemas = schemas;
1271 return XmlReader.Create(reader, xmlReaderSettings);
1272 }
1273
1274 public virtual XPathExpression Compile(string xpath)
1275 {
1277 }
1278
1279 public virtual XPathNavigator? SelectSingleNode(string xpath)
1280 {
1282 }
1283
1288
1290 {
1292 if (xPathNodeIterator.MoveNext())
1293 {
1294 return xPathNodeIterator.Current;
1295 }
1296 return null;
1297 }
1298
1299 public virtual XPathNodeIterator Select(string xpath)
1300 {
1302 }
1303
1308
1310 {
1311 if (!(Evaluate(expr) is XPathNodeIterator result))
1312 {
1314 }
1315 return result;
1316 }
1317
1318 public virtual object Evaluate(string xpath)
1319 {
1320 return Evaluate(XPathExpression.Compile(xpath), null);
1321 }
1322
1323 public virtual object Evaluate(string xpath, IXmlNamespaceResolver? resolver)
1324 {
1326 }
1327
1328 public virtual object Evaluate(XPathExpression expr)
1329 {
1330 return Evaluate(expr, null);
1331 }
1332
1333 public virtual object Evaluate(XPathExpression expr, XPathNodeIterator? context)
1334 {
1336 {
1338 }
1340 query.Reset();
1341 if (context == null)
1342 {
1343 context = new XPathSingletonIterator(Clone(), moved: true);
1344 }
1345 object obj = query.Evaluate(context);
1347 {
1348 return new XPathSelectionIterator(context.Current, query);
1349 }
1350 return obj;
1351 }
1352
1353 public virtual bool Matches(XPathExpression expr)
1354 {
1356 {
1358 }
1360 try
1361 {
1362 return query.MatchNode(this) != null;
1363 }
1364 catch (XPathException)
1365 {
1367 }
1368 }
1369
1370 public virtual bool Matches(string xpath)
1371 {
1373 }
1374
1376 {
1377 return new XPathChildIterator(Clone(), type);
1378 }
1379
1380 public virtual XPathNodeIterator SelectChildren(string name, string namespaceURI)
1381 {
1382 return new XPathChildIterator(Clone(), name, namespaceURI);
1383 }
1384
1385 public virtual XPathNodeIterator SelectAncestors(XPathNodeType type, bool matchSelf)
1386 {
1387 return new XPathAncestorIterator(Clone(), type, matchSelf);
1388 }
1389
1390 public virtual XPathNodeIterator SelectAncestors(string name, string namespaceURI, bool matchSelf)
1391 {
1392 return new XPathAncestorIterator(Clone(), name, namespaceURI, matchSelf);
1393 }
1394
1396 {
1397 return new XPathDescendantIterator(Clone(), type, matchSelf);
1398 }
1399
1400 public virtual XPathNodeIterator SelectDescendants(string name, string namespaceURI, bool matchSelf)
1401 {
1402 return new XPathDescendantIterator(Clone(), name, namespaceURI, matchSelf);
1403 }
1404
1405 public virtual XmlWriter PrependChild()
1406 {
1407 throw new NotSupportedException();
1408 }
1409
1410 public virtual XmlWriter AppendChild()
1411 {
1412 throw new NotSupportedException();
1413 }
1414
1415 public virtual XmlWriter InsertAfter()
1416 {
1417 throw new NotSupportedException();
1418 }
1419
1420 public virtual XmlWriter InsertBefore()
1421 {
1422 throw new NotSupportedException();
1423 }
1424
1426 {
1427 throw new NotSupportedException();
1428 }
1429
1431 {
1432 throw new NotSupportedException();
1433 }
1434
1435 public virtual void ReplaceSelf(string newNode)
1436 {
1439 }
1440
1441 public virtual void ReplaceSelf(XmlReader newNode)
1442 {
1443 if (newNode == null)
1444 {
1445 throw new ArgumentNullException("newNode");
1446 }
1447 XPathNodeType nodeType = NodeType;
1448 if (nodeType == XPathNodeType.Root || nodeType == XPathNodeType.Attribute || nodeType == XPathNodeType.Namespace)
1449 {
1451 }
1454 xmlWriter.Close();
1455 }
1456
1458 {
1459 if (newNode == null)
1460 {
1461 throw new ArgumentNullException("newNode");
1462 }
1463 XmlReader newNode2 = newNode.CreateReader();
1465 }
1466
1467 public virtual void AppendChild(string newChild)
1468 {
1471 }
1472
1473 public virtual void AppendChild(XmlReader newChild)
1474 {
1475 if (newChild == null)
1476 {
1477 throw new ArgumentNullException("newChild");
1478 }
1481 xmlWriter.Close();
1482 }
1483
1485 {
1486 if (newChild == null)
1487 {
1488 throw new ArgumentNullException("newChild");
1489 }
1490 if (!IsValidChildType(newChild.NodeType))
1491 {
1493 }
1494 XmlReader newChild2 = newChild.CreateReader();
1496 }
1497
1498 public virtual void PrependChild(string newChild)
1499 {
1502 }
1503
1504 public virtual void PrependChild(XmlReader newChild)
1505 {
1506 if (newChild == null)
1507 {
1508 throw new ArgumentNullException("newChild");
1509 }
1512 xmlWriter.Close();
1513 }
1514
1516 {
1517 if (newChild == null)
1518 {
1519 throw new ArgumentNullException("newChild");
1520 }
1521 if (!IsValidChildType(newChild.NodeType))
1522 {
1524 }
1525 XmlReader newChild2 = newChild.CreateReader();
1527 }
1528
1529 public virtual void InsertBefore(string newSibling)
1530 {
1533 }
1534
1535 public virtual void InsertBefore(XmlReader newSibling)
1536 {
1537 if (newSibling == null)
1538 {
1539 throw new ArgumentNullException("newSibling");
1540 }
1543 xmlWriter.Close();
1544 }
1545
1547 {
1548 if (newSibling == null)
1549 {
1550 throw new ArgumentNullException("newSibling");
1551 }
1552 if (!IsValidSiblingType(newSibling.NodeType))
1553 {
1555 }
1556 XmlReader newSibling2 = newSibling.CreateReader();
1558 }
1559
1560 public virtual void InsertAfter(string newSibling)
1561 {
1564 }
1565
1566 public virtual void InsertAfter(XmlReader newSibling)
1567 {
1568 if (newSibling == null)
1569 {
1570 throw new ArgumentNullException("newSibling");
1571 }
1574 xmlWriter.Close();
1575 }
1576
1578 {
1579 if (newSibling == null)
1580 {
1581 throw new ArgumentNullException("newSibling");
1582 }
1583 if (!IsValidSiblingType(newSibling.NodeType))
1584 {
1586 }
1587 XmlReader newSibling2 = newSibling.CreateReader();
1589 }
1590
1592 {
1593 throw new NotSupportedException();
1594 }
1595
1596 public virtual void DeleteSelf()
1597 {
1598 DeleteRange(this);
1599 }
1600
1601 public virtual void PrependChildElement(string prefix, string localName, string namespaceURI, string value)
1602 {
1604 xmlWriter.WriteStartElement(prefix, localName, namespaceURI);
1605 if (value != null)
1606 {
1607 xmlWriter.WriteString(value);
1608 }
1609 xmlWriter.WriteEndElement();
1610 xmlWriter.Close();
1611 }
1612
1613 public virtual void AppendChildElement(string prefix, string localName, string namespaceURI, string value)
1614 {
1616 xmlWriter.WriteStartElement(prefix, localName, namespaceURI);
1617 if (value != null)
1618 {
1619 xmlWriter.WriteString(value);
1620 }
1621 xmlWriter.WriteEndElement();
1622 xmlWriter.Close();
1623 }
1624
1625 public virtual void InsertElementBefore(string prefix, string localName, string namespaceURI, string value)
1626 {
1628 xmlWriter.WriteStartElement(prefix, localName, namespaceURI);
1629 if (value != null)
1630 {
1631 xmlWriter.WriteString(value);
1632 }
1633 xmlWriter.WriteEndElement();
1634 xmlWriter.Close();
1635 }
1636
1637 public virtual void InsertElementAfter(string prefix, string localName, string namespaceURI, string value)
1638 {
1640 xmlWriter.WriteStartElement(prefix, localName, namespaceURI);
1641 if (value != null)
1642 {
1643 xmlWriter.WriteString(value);
1644 }
1645 xmlWriter.WriteEndElement();
1646 xmlWriter.Close();
1647 }
1648
1649 public virtual void CreateAttribute(string prefix, string localName, string namespaceURI, string value)
1650 {
1652 xmlWriter.WriteStartAttribute(prefix, localName, namespaceURI);
1653 if (value != null)
1654 {
1655 xmlWriter.WriteString(value);
1656 }
1657 xmlWriter.WriteEndAttribute();
1658 xmlWriter.Close();
1659 }
1660
1661 internal bool MoveToPrevious(string localName, string namespaceURI)
1662 {
1664 string text = ((localName != null) ? NameTable.Get(localName) : null);
1665 while (MoveToPrevious())
1666 {
1667 if (NodeType == XPathNodeType.Element && text == LocalName && namespaceURI == NamespaceURI)
1668 {
1669 return true;
1670 }
1671 }
1672 MoveTo(other);
1673 return false;
1674 }
1675
1677 {
1680 while (MoveToPrevious())
1681 {
1682 if (((1 << (int)NodeType) & contentKindMask) != 0)
1683 {
1684 return true;
1685 }
1686 }
1687 MoveTo(other);
1688 return false;
1689 }
1690
1691 internal bool MoveToNonDescendant()
1692 {
1693 if (NodeType == XPathNodeType.Root)
1694 {
1695 return false;
1696 }
1697 if (MoveToNext())
1698 {
1699 return true;
1700 }
1702 if (!MoveToParent())
1703 {
1704 return false;
1705 }
1706 XPathNodeType nodeType = xPathNavigator.NodeType;
1707 if ((uint)(nodeType - 2) <= 1u && MoveToFirstChild())
1708 {
1709 return true;
1710 }
1711 while (!MoveToNext())
1712 {
1713 if (!MoveToParent())
1714 {
1716 return false;
1717 }
1718 }
1719 return true;
1720 }
1721
1728
1729 private static int GetDepth(XPathNavigator nav)
1730 {
1731 int num = 0;
1732 while (nav.MoveToParent())
1733 {
1734 num++;
1735 }
1736 return num;
1737 }
1738
1740 {
1741 int num = 0;
1742 switch (n1.NodeType)
1743 {
1744 case XPathNodeType.Attribute:
1745 num++;
1746 break;
1747 default:
1748 num += 2;
1749 break;
1750 case XPathNodeType.Namespace:
1751 break;
1752 }
1753 switch (n2.NodeType)
1754 {
1755 case XPathNodeType.Namespace:
1756 if (num != 0)
1757 {
1758 break;
1759 }
1760 while (n1.MoveToNextNamespace())
1761 {
1762 if (n1.IsSamePosition(n2))
1763 {
1764 return XmlNodeOrder.Before;
1765 }
1766 }
1767 break;
1768 case XPathNodeType.Attribute:
1769 num--;
1770 if (num != 0)
1771 {
1772 break;
1773 }
1774 while (n1.MoveToNextAttribute())
1775 {
1776 if (n1.IsSamePosition(n2))
1777 {
1778 return XmlNodeOrder.Before;
1779 }
1780 }
1781 break;
1782 default:
1783 num -= 2;
1784 if (num != 0)
1785 {
1786 break;
1787 }
1788 while (n1.MoveToNext())
1789 {
1790 if (n1.IsSamePosition(n2))
1791 {
1792 return XmlNodeOrder.Before;
1793 }
1794 }
1795 break;
1796 }
1797 if (num >= 0)
1798 {
1799 return XmlNodeOrder.After;
1800 }
1801 return XmlNodeOrder.Before;
1802 }
1803
1805 {
1809 {
1810 if (item.Key != "xmlns")
1811 {
1812 xmlNamespaceManager.AddNamespace(item.Key, item.Value);
1813 }
1814 }
1815 return xmlNamespaceManager;
1816 }
1817
1819 {
1820 return ContentKindMasks[(int)type];
1821 }
1822
1823 internal static int GetKindMask(XPathNodeType type)
1824 {
1825 return type switch
1826 {
1827 XPathNodeType.All => int.MaxValue,
1828 XPathNodeType.Text => 112,
1829 _ => 1 << (int)type,
1830 };
1831 }
1832
1833 internal static bool IsText(XPathNodeType type)
1834 {
1835 return (uint)(type - 4) <= 2u;
1836 }
1837
1839 {
1840 switch (NodeType)
1841 {
1842 case XPathNodeType.Root:
1843 if (type == XPathNodeType.Element || (uint)(type - 5) <= 3u)
1844 {
1845 return true;
1846 }
1847 break;
1848 case XPathNodeType.Element:
1849 if (type == XPathNodeType.Element || (uint)(type - 4) <= 4u)
1850 {
1851 return true;
1852 }
1853 break;
1854 }
1855 return false;
1856 }
1857
1859 {
1860 XPathNodeType nodeType = NodeType;
1861 if ((nodeType == XPathNodeType.Element || (uint)(nodeType - 4) <= 4u) && (type == XPathNodeType.Element || (uint)(type - 4) <= 4u))
1862 {
1863 return true;
1864 }
1865 return false;
1866 }
1867
1869 {
1870 return XPathNavigatorReader.Create(this);
1871 }
1872
1874 {
1875 if (xml == null)
1876 {
1877 throw new ArgumentNullException("xml");
1878 }
1881 if (!fromCurrentNode)
1882 {
1883 xPathNavigator.MoveToParent();
1884 }
1885 if (xPathNavigator.MoveToFirstNamespace(XPathNamespaceScope.All))
1886 {
1887 do
1888 {
1889 xmlNamespaceManager.AddNamespace(xPathNavigator.LocalName, xPathNavigator.Value);
1890 }
1891 while (xPathNavigator.MoveToNextNamespace(XPathNamespaceScope.All));
1892 }
1894 XmlTextReader xmlTextReader = new XmlTextReader(xml, XmlNodeType.Element, context);
1896 return xmlTextReader;
1897 }
1898
1900 {
1901 string text = "http://www.w3.org/2000/xmlns/";
1902 ReadState readState = reader.ReadState;
1903 if (readState != 0 && readState != ReadState.Interactive)
1904 {
1905 throw new ArgumentException(System.SR.Xml_InvalidOperation, "reader");
1906 }
1907 int num = 0;
1908 if (readState == ReadState.Initial)
1909 {
1910 if (!reader.Read())
1911 {
1912 return;
1913 }
1914 num++;
1915 }
1916 do
1917 {
1918 switch (reader.NodeType)
1919 {
1920 case XmlNodeType.Element:
1921 {
1922 writer.WriteStartElement(reader.Prefix, reader.LocalName, reader.NamespaceURI);
1923 bool isEmptyElement = reader.IsEmptyElement;
1924 while (reader.MoveToNextAttribute())
1925 {
1926 if ((object)reader.NamespaceURI == text)
1927 {
1928 if (reader.Prefix.Length == 0)
1929 {
1930 writer.WriteAttributeString("", "xmlns", text, reader.Value);
1931 }
1932 else
1933 {
1934 writer.WriteAttributeString("xmlns", reader.LocalName, text, reader.Value);
1935 }
1936 }
1937 else
1938 {
1939 writer.WriteStartAttribute(reader.Prefix, reader.LocalName, reader.NamespaceURI);
1940 writer.WriteString(reader.Value);
1941 writer.WriteEndAttribute();
1942 }
1943 }
1944 reader.MoveToElement();
1945 if (isEmptyElement)
1946 {
1947 writer.WriteEndElement();
1948 }
1949 else
1950 {
1951 num++;
1952 }
1953 break;
1954 }
1955 case XmlNodeType.EndElement:
1956 writer.WriteFullEndElement();
1957 num--;
1958 break;
1959 case XmlNodeType.Text:
1960 case XmlNodeType.CDATA:
1961 writer.WriteString(reader.Value);
1962 break;
1963 case XmlNodeType.Whitespace:
1964 case XmlNodeType.SignificantWhitespace:
1965 writer.WriteString(reader.Value);
1966 break;
1967 case XmlNodeType.Comment:
1968 writer.WriteComment(reader.Value);
1969 break;
1970 case XmlNodeType.ProcessingInstruction:
1971 writer.WriteProcessingInstruction(reader.LocalName, reader.Value);
1972 break;
1973 case XmlNodeType.EntityReference:
1974 reader.ResolveEntity();
1975 break;
1976 case XmlNodeType.Attribute:
1977 if ((object)reader.NamespaceURI == text)
1978 {
1979 if (reader.Prefix.Length == 0)
1980 {
1981 writer.WriteAttributeString("", "xmlns", text, reader.Value);
1982 }
1983 else
1984 {
1985 writer.WriteAttributeString("xmlns", reader.LocalName, text, reader.Value);
1986 }
1987 }
1988 else
1989 {
1990 writer.WriteStartAttribute(reader.Prefix, reader.LocalName, reader.NamespaceURI);
1991 writer.WriteString(reader.Value);
1992 writer.WriteEndAttribute();
1993 }
1994 break;
1995 }
1996 }
1997 while (reader.Read() && num > 0);
1998 }
1999}
Query BuildPatternQuery(string query, bool allowVar, bool allowKey)
static Query Clone(Query input)
Definition Query.cs:66
static CultureInfo InvariantCulture
static string XPathDocument_MissingSchemas
Definition SR.cs:1354
static string Xp_BadQueryObject
Definition SR.cs:1252
static string XPathDocument_ValidateInvalidNodeType
Definition SR.cs:1358
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Xp_NodeSetExpected
Definition SR.cs:1244
static string Xp_InvalidPattern
Definition SR.cs:1248
static string Xpn_BadPosition
Definition SR.cs:1316
static string XPathDocument_NotEnoughSchemaInfo
Definition SR.cs:1356
static string Xml_InvalidOperation
Definition SR.cs:18
Definition SR.cs:7
override? string Get(string value)
Definition NameTable.cs:79
object ParseValue(string s, XmlNameTable? nameTable, IXmlNamespaceResolver? nsmgr)
XmlReader Validate(XmlReader reader, XmlResolver resolver, XmlSchemaSet schemaSet, ValidationEventHandler valEventHandler)
static readonly XmlValueConverter Untyped
static XPathException Create(string res)
static XPathExpression Compile(string xpath)
static XPathNavigatorReader Create(XPathNavigator navToRead)
readonly ValidationEventHandler _nextEventHandler
CheckValidityHelper(ValidationEventHandler nextEventHandler, XPathNavigatorReader reader)
void ValidationCallback(object sender, ValidationEventArgs args)
override object ValueAs(Type returnType, IXmlNamespaceResolver? nsResolver)
virtual void ReplaceSelf(string newNode)
virtual void PrependChild(XmlReader newChild)
bool MoveToFirstNamespace(XPathNamespaceScope namespaceScope)
virtual string GetAttribute(string localName, string namespaceURI)
virtual ? XPathNavigator SelectSingleNode(string xpath, IXmlNamespaceResolver? resolver)
static readonly char[] NodeTypeLetter
virtual XPathNodeIterator Select(string xpath, IXmlNamespaceResolver? resolver)
static int GetContentKindMask(XPathNodeType type)
virtual void AppendChild(XmlReader newChild)
virtual XPathNodeIterator SelectAncestors(string name, string namespaceURI, bool matchSelf)
bool MoveTo(XPathNavigator other)
virtual XPathNodeIterator SelectDescendants(string name, string namespaceURI, bool matchSelf)
override? XmlSchemaType XmlType
bool MoveToPrevious(string localName, string namespaceURI)
bool IsSamePosition(XPathNavigator other)
virtual XmlWriter ReplaceRange(XPathNavigator lastSiblingToReplace)
virtual object Evaluate(string xpath, IXmlNamespaceResolver? resolver)
virtual object Evaluate(string xpath)
virtual bool Matches(XPathExpression expr)
virtual IDictionary< string, string > GetNamespacesInScope(XmlNamespaceScope scope)
virtual void InsertElementBefore(string prefix, string localName, string namespaceURI, string value)
virtual object Evaluate(XPathExpression expr, XPathNodeIterator? context)
static XmlNamespaceManager GetNamespaces(IXmlNamespaceResolver resolver)
virtual bool MoveToNamespace(string name)
virtual void AppendChildElement(string prefix, string localName, string namespaceURI, string value)
virtual XPathNodeIterator Select(string xpath)
virtual XmlNodeOrder ComparePosition(XPathNavigator? nav)
virtual XPathNodeIterator SelectDescendants(XPathNodeType type, bool matchSelf)
virtual bool MoveToAttribute(string localName, string namespaceURI)
void BuildSubtree(XmlReader reader, XmlWriter writer)
virtual bool MoveToFollowing(XPathNodeType type)
virtual ? XPathNavigator SelectSingleNode(XPathExpression expression)
virtual bool MoveToFollowing(string localName, string namespaceURI, XPathNavigator? end)
virtual void InsertBefore(string newSibling)
bool MoveToPrevious(XPathNodeType type)
virtual bool IsDescendant([NotNullWhen(true)] XPathNavigator? nav)
virtual ? string LookupPrefix(string namespaceURI)
virtual void PrependChildElement(string prefix, string localName, string namespaceURI, string value)
virtual void DeleteRange(XPathNavigator lastSiblingToDelete)
virtual string GetNamespace(string name)
bool MoveToNextNamespace(XPathNamespaceScope namespaceScope)
static int GetDepth(XPathNavigator nav)
static IEqualityComparer NavigatorComparer
virtual bool MoveToFollowing(string localName, string namespaceURI)
static int GetKindMask(XPathNodeType type)
virtual XPathNodeIterator Select(XPathExpression expr)
virtual bool CheckValidity(XmlSchemaSet schemas, ValidationEventHandler validationEventHandler)
virtual ? string LookupNamespace(string prefix)
virtual void CreateAttribute(string prefix, string localName, string namespaceURI, string value)
static readonly XPathNavigatorKeyComparer comparer
virtual XmlWriter CreateAttributes()
virtual bool MoveToChild(string localName, string namespaceURI)
virtual ? IXmlSchemaInfo SchemaInfo
virtual object Evaluate(XPathExpression expr)
XmlReader GetValidatingReader(XmlReader reader, XmlSchemaSet schemas, ValidationEventHandler validationEvent, XmlSchemaType schemaType, XmlSchemaElement schemaElement, XmlSchemaAttribute schemaAttribute)
virtual void SetValue(string value)
virtual void AppendChild(string newChild)
XmlReader CreateContextReader(string xml, bool fromCurrentNode)
virtual bool MoveToChild(XPathNodeType type)
virtual void ReplaceSelf(XmlReader newNode)
virtual void SetTypedValue(object typedValue)
XmlNodeOrder CompareSiblings(XPathNavigator n1, XPathNavigator n2)
virtual XPathNodeIterator SelectChildren(XPathNodeType type)
virtual XPathNodeIterator SelectChildren(string name, string namespaceURI)
virtual bool MoveToNext(string localName, string namespaceURI)
virtual void ReplaceSelf(XPathNavigator newNode)
virtual void InsertAfter(XPathNavigator newSibling)
virtual XPathNavigator CreateNavigator()
virtual bool Matches(string xpath)
virtual void WriteSubtree(XmlWriter writer)
virtual void PrependChild(string newChild)
bool IsValidSiblingType(XPathNodeType type)
virtual void PrependChild(XPathNavigator newChild)
static readonly char[] UniqueIdTbl
virtual void InsertElementAfter(string prefix, string localName, string namespaceURI, string value)
static readonly int[] ContentKindMasks
virtual void InsertAfter(string newSibling)
virtual bool MoveToFollowing(XPathNodeType type, XPathNavigator? end)
virtual void InsertBefore(XmlReader newSibling)
virtual void AppendChild(XPathNavigator newChild)
virtual ? XPathNavigator SelectSingleNode(string xpath)
virtual XPathExpression Compile(string xpath)
static bool IsText(XPathNodeType type)
virtual void InsertAfter(XmlReader newSibling)
virtual void InsertBefore(XPathNavigator newSibling)
static XPathExpression CompileMatchPattern(string xpath)
virtual bool MoveToNext(XPathNodeType type)
virtual XPathNodeIterator SelectAncestors(XPathNodeType type, bool matchSelf)
bool IsValidChildType(XPathNodeType type)
static string EscapeValueForDebuggerDisplay(string value)
XmlNodeType NodeType
Definition XmlReader.cs:62
static XmlReader Create(string inputUri)
static XmlWriter Create(string outputFileName)
Definition XmlWriter.cs:468
XmlSchemaAttribute? SchemaAttribute
XmlSchemaSimpleType? MemberType