mscorlib(4.0.0.0) API with additions
XmlNode.cs
1 using System.Collections;
2 using System.Diagnostics;
4 using System.IO;
5 using System.Text;
6 using System.Xml.Schema;
7 using System.Xml.XPath;
8 
9 namespace System.Xml
10 {
12  [DebuggerDisplay("{debuggerDisplayProxy}")]
13  public abstract class XmlNode : ICloneable, IEnumerable, IXPathNavigable
14  {
15  internal XmlNode parentNode;
16 
19  public abstract string Name
20  {
21  get;
22  }
23 
35  public virtual string Value
36  {
37  get
38  {
39  return null;
40  }
41  set
42  {
43  throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Res.GetString("Xdom_Node_SetVal"), new object[1]
44  {
45  NodeType.ToString()
46  }));
47  }
48  }
49 
52  public abstract XmlNodeType NodeType
53  {
54  get;
55  }
56 
59  public virtual XmlNode ParentNode
60  {
61  get
62  {
63  if (parentNode.NodeType != XmlNodeType.Document)
64  {
65  return parentNode;
66  }
67  XmlLinkedNode xmlLinkedNode = parentNode.FirstChild as XmlLinkedNode;
68  if (xmlLinkedNode != null)
69  {
70  XmlLinkedNode xmlLinkedNode2 = xmlLinkedNode;
71  do
72  {
73  if (xmlLinkedNode2 == this)
74  {
75  return parentNode;
76  }
77  xmlLinkedNode2 = xmlLinkedNode2.next;
78  }
79  while (xmlLinkedNode2 != null && xmlLinkedNode2 != xmlLinkedNode);
80  }
81  return null;
82  }
83  }
84 
87  public virtual XmlNodeList ChildNodes => new XmlChildNodes(this);
88 
91  public virtual XmlNode PreviousSibling => null;
92 
95  public virtual XmlNode NextSibling => null;
96 
99  public virtual XmlAttributeCollection Attributes => null;
100 
103  public virtual XmlDocument OwnerDocument
104  {
105  get
106  {
107  if (parentNode.NodeType == XmlNodeType.Document)
108  {
109  return (XmlDocument)parentNode;
110  }
111  return parentNode.OwnerDocument;
112  }
113  }
114 
117  public virtual XmlNode FirstChild => LastNode?.next;
118 
121  public virtual XmlNode LastChild => LastNode;
122 
123  internal virtual bool IsContainer => false;
124 
125  internal virtual XmlLinkedNode LastNode
126  {
127  get
128  {
129  return null;
130  }
131  set
132  {
133  }
134  }
135 
139  public virtual bool HasChildNodes => LastNode != null;
140 
143  public virtual string NamespaceURI => string.Empty;
144 
149  public virtual string Prefix
150  {
151  get
152  {
153  return string.Empty;
154  }
155  set
156  {
157  }
158  }
159 
162  public abstract string LocalName
163  {
164  get;
165  }
166 
170  public virtual bool IsReadOnly
171  {
172  get
173  {
174  XmlDocument ownerDocument = OwnerDocument;
175  return HasReadOnlyParent(this);
176  }
177  }
178 
181  public virtual string InnerText
182  {
183  get
184  {
185  XmlNode firstChild = FirstChild;
186  if (firstChild == null)
187  {
188  return string.Empty;
189  }
190  if (firstChild.NextSibling == null)
191  {
192  switch (firstChild.NodeType)
193  {
194  case XmlNodeType.Text:
195  case XmlNodeType.CDATA:
196  case XmlNodeType.Whitespace:
197  case XmlNodeType.SignificantWhitespace:
198  return firstChild.Value;
199  }
200  }
201  StringBuilder stringBuilder = new StringBuilder();
202  AppendChildText(stringBuilder);
203  return stringBuilder.ToString();
204  }
205  set
206  {
207  XmlNode firstChild = FirstChild;
208  if (firstChild != null && firstChild.NextSibling == null && firstChild.NodeType == XmlNodeType.Text)
209  {
210  firstChild.Value = value;
211  return;
212  }
213  RemoveAll();
215  }
216  }
217 
221  public virtual string OuterXml
222  {
223  get
224  {
226  XmlDOMTextWriter xmlDOMTextWriter = new XmlDOMTextWriter(stringWriter);
227  try
228  {
229  WriteTo(xmlDOMTextWriter);
230  }
231  finally
232  {
233  xmlDOMTextWriter.Close();
234  }
235  return stringWriter.ToString();
236  }
237  }
238 
244  public virtual string InnerXml
245  {
246  get
247  {
249  XmlDOMTextWriter xmlDOMTextWriter = new XmlDOMTextWriter(stringWriter);
250  try
251  {
252  WriteContentTo(xmlDOMTextWriter);
253  }
254  finally
255  {
256  xmlDOMTextWriter.Close();
257  }
258  return stringWriter.ToString();
259  }
260  set
261  {
262  throw new InvalidOperationException(Res.GetString("Xdom_Set_InnerXml"));
263  }
264  }
265 
268  public virtual IXmlSchemaInfo SchemaInfo => XmlDocument.NotKnownSchemaInfo;
269 
272  public virtual string BaseURI
273  {
274  get
275  {
276  for (XmlNode xmlNode = ParentNode; xmlNode != null; xmlNode = xmlNode.ParentNode)
277  {
278  switch (xmlNode.NodeType)
279  {
280  case XmlNodeType.EntityReference:
281  return ((XmlEntityReference)xmlNode).ChildBaseURI;
282  case XmlNodeType.Attribute:
283  case XmlNodeType.Entity:
284  case XmlNodeType.Document:
285  return xmlNode.BaseURI;
286  }
287  }
288  return string.Empty;
289  }
290  }
291 
292  internal XmlDocument Document
293  {
294  get
295  {
296  if (NodeType == XmlNodeType.Document)
297  {
298  return (XmlDocument)this;
299  }
300  return OwnerDocument;
301  }
302  }
303 
307  public virtual XmlElement this[string name]
308  {
309  get
310  {
311  for (XmlNode xmlNode = FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
312  {
313  if (xmlNode.NodeType == XmlNodeType.Element && xmlNode.Name == name)
314  {
315  return (XmlElement)xmlNode;
316  }
317  }
318  return null;
319  }
320  }
321 
326  public virtual XmlElement this[string localname, string ns]
327  {
328  get
329  {
330  for (XmlNode xmlNode = FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
331  {
332  if (xmlNode.NodeType == XmlNodeType.Element && xmlNode.LocalName == localname && xmlNode.NamespaceURI == ns)
333  {
334  return (XmlElement)xmlNode;
335  }
336  }
337  return null;
338  }
339  }
340 
341  internal virtual XmlSpace XmlSpace
342  {
343  get
344  {
345  XmlNode xmlNode = this;
346  XmlElement xmlElement = null;
347  do
348  {
349  xmlElement = (xmlNode as XmlElement);
350  if (xmlElement != null && xmlElement.HasAttribute("xml:space"))
351  {
352  string a = XmlConvert.TrimString(xmlElement.GetAttribute("xml:space"));
353  if (a == "default")
354  {
355  return XmlSpace.Default;
356  }
357  if (a == "preserve")
358  {
359  return XmlSpace.Preserve;
360  }
361  }
362  xmlNode = xmlNode.ParentNode;
363  }
364  while (xmlNode != null);
365  return XmlSpace.None;
366  }
367  }
368 
369  internal virtual string XmlLang
370  {
371  get
372  {
373  XmlNode xmlNode = this;
374  XmlElement xmlElement = null;
375  do
376  {
377  xmlElement = (xmlNode as XmlElement);
378  if (xmlElement != null && xmlElement.HasAttribute("xml:lang"))
379  {
380  return xmlElement.GetAttribute("xml:lang");
381  }
382  xmlNode = xmlNode.ParentNode;
383  }
384  while (xmlNode != null);
385  return string.Empty;
386  }
387  }
388 
389  internal virtual XPathNodeType XPNodeType => (XPathNodeType)(-1);
390 
391  internal virtual string XPLocalName => string.Empty;
392 
393  internal virtual bool IsText => false;
394 
397  public virtual XmlNode PreviousText => null;
398 
399  private object debuggerDisplayProxy => new DebuggerDisplayXmlNodeProxy(this);
400 
401  internal XmlNode()
402  {
403  }
404 
405  internal XmlNode(XmlDocument doc)
406  {
407  if (doc == null)
408  {
409  throw new ArgumentException(Res.GetString("Xdom_Node_Null_Doc"));
410  }
411  parentNode = doc;
412  }
413 
417  {
418  XmlDocument xmlDocument = this as XmlDocument;
419  if (xmlDocument != null)
420  {
421  return xmlDocument.CreateNavigator(this);
422  }
423  XmlDocument ownerDocument = OwnerDocument;
424  return ownerDocument.CreateNavigator(this);
425  }
426 
431  public XmlNode SelectSingleNode(string xpath)
432  {
433  return SelectNodes(xpath)?[0];
434  }
435 
441  public XmlNode SelectSingleNode(string xpath, XmlNamespaceManager nsmgr)
442  {
443  XPathNavigator xPathNavigator = CreateNavigator();
444  if (xPathNavigator == null)
445  {
446  return null;
447  }
448  XPathExpression xPathExpression = xPathNavigator.Compile(xpath);
449  xPathExpression.SetContext(nsmgr);
450  return new XPathNodeList(xPathNavigator.Select(xPathExpression))[0];
451  }
452 
457  public XmlNodeList SelectNodes(string xpath)
458  {
459  XPathNavigator xPathNavigator = CreateNavigator();
460  if (xPathNavigator == null)
461  {
462  return null;
463  }
464  return new XPathNodeList(xPathNavigator.Select(xpath));
465  }
466 
472  public XmlNodeList SelectNodes(string xpath, XmlNamespaceManager nsmgr)
473  {
474  XPathNavigator xPathNavigator = CreateNavigator();
475  if (xPathNavigator == null)
476  {
477  return null;
478  }
479  XPathExpression xPathExpression = xPathNavigator.Compile(xpath);
480  xPathExpression.SetContext(nsmgr);
481  return new XPathNodeList(xPathNavigator.Select(xPathExpression));
482  }
483 
484  internal bool AncestorNode(XmlNode node)
485  {
486  XmlNode xmlNode = ParentNode;
487  while (xmlNode != null && xmlNode != this)
488  {
489  if (xmlNode == node)
490  {
491  return true;
492  }
493  xmlNode = xmlNode.ParentNode;
494  }
495  return false;
496  }
497 
498  internal bool IsConnected()
499  {
500  XmlNode xmlNode = ParentNode;
501  while (xmlNode != null && xmlNode.NodeType != XmlNodeType.Document)
502  {
503  xmlNode = xmlNode.ParentNode;
504  }
505  return xmlNode != null;
506  }
507 
514  public virtual XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
515  {
516  if (this == newChild || AncestorNode(newChild))
517  {
518  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Child"));
519  }
520  if (refChild == null)
521  {
522  return AppendChild(newChild);
523  }
524  if (!IsContainer)
525  {
526  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Contain"));
527  }
528  if (refChild.ParentNode != this)
529  {
530  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Path"));
531  }
532  if (newChild == refChild)
533  {
534  return newChild;
535  }
536  XmlDocument ownerDocument = newChild.OwnerDocument;
537  XmlDocument ownerDocument2 = OwnerDocument;
538  if (ownerDocument != null && ownerDocument != ownerDocument2 && ownerDocument != this)
539  {
540  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Context"));
541  }
542  if (!CanInsertBefore(newChild, refChild))
543  {
544  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Location"));
545  }
546  if (newChild.ParentNode != null)
547  {
548  newChild.ParentNode.RemoveChild(newChild);
549  }
550  if (newChild.NodeType == XmlNodeType.DocumentFragment)
551  {
552  XmlNode firstChild = newChild.FirstChild;
553  XmlNode xmlNode = firstChild;
554  if (xmlNode != null)
555  {
556  newChild.RemoveChild(xmlNode);
557  InsertBefore(xmlNode, refChild);
558  InsertAfter(newChild, xmlNode);
559  }
560  return firstChild;
561  }
562  if (!(newChild is XmlLinkedNode) || !IsValidChildType(newChild.NodeType))
563  {
564  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_TypeConflict"));
565  }
566  XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
567  XmlLinkedNode xmlLinkedNode2 = (XmlLinkedNode)refChild;
568  string value = newChild.Value;
569  XmlNodeChangedEventArgs eventArgs = GetEventArgs(newChild, newChild.ParentNode, this, value, value, XmlNodeChangedAction.Insert);
570  if (eventArgs != null)
571  {
572  BeforeEvent(eventArgs);
573  }
574  if (xmlLinkedNode2 == FirstChild)
575  {
576  xmlLinkedNode.next = xmlLinkedNode2;
577  LastNode.next = xmlLinkedNode;
578  xmlLinkedNode.SetParent(this);
579  if (xmlLinkedNode.IsText && xmlLinkedNode2.IsText)
580  {
581  NestTextNodes(xmlLinkedNode, xmlLinkedNode2);
582  }
583  }
584  else
585  {
586  XmlLinkedNode xmlLinkedNode3 = (XmlLinkedNode)xmlLinkedNode2.PreviousSibling;
587  xmlLinkedNode.next = xmlLinkedNode2;
588  xmlLinkedNode3.next = xmlLinkedNode;
589  xmlLinkedNode.SetParent(this);
590  if (xmlLinkedNode3.IsText)
591  {
592  if (xmlLinkedNode.IsText)
593  {
594  NestTextNodes(xmlLinkedNode3, xmlLinkedNode);
595  if (xmlLinkedNode2.IsText)
596  {
597  NestTextNodes(xmlLinkedNode, xmlLinkedNode2);
598  }
599  }
600  else if (xmlLinkedNode2.IsText)
601  {
602  UnnestTextNodes(xmlLinkedNode3, xmlLinkedNode2);
603  }
604  }
605  else if (xmlLinkedNode.IsText && xmlLinkedNode2.IsText)
606  {
607  NestTextNodes(xmlLinkedNode, xmlLinkedNode2);
608  }
609  }
610  if (eventArgs != null)
611  {
612  AfterEvent(eventArgs);
613  }
614  return xmlLinkedNode;
615  }
616 
623  public virtual XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
624  {
625  if (this == newChild || AncestorNode(newChild))
626  {
627  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Child"));
628  }
629  if (refChild == null)
630  {
631  return PrependChild(newChild);
632  }
633  if (!IsContainer)
634  {
635  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Contain"));
636  }
637  if (refChild.ParentNode != this)
638  {
639  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Path"));
640  }
641  if (newChild == refChild)
642  {
643  return newChild;
644  }
645  XmlDocument ownerDocument = newChild.OwnerDocument;
646  XmlDocument ownerDocument2 = OwnerDocument;
647  if (ownerDocument != null && ownerDocument != ownerDocument2 && ownerDocument != this)
648  {
649  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Context"));
650  }
651  if (!CanInsertAfter(newChild, refChild))
652  {
653  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Location"));
654  }
655  if (newChild.ParentNode != null)
656  {
657  newChild.ParentNode.RemoveChild(newChild);
658  }
659  if (newChild.NodeType == XmlNodeType.DocumentFragment)
660  {
661  XmlNode refChild2 = refChild;
662  XmlNode firstChild = newChild.FirstChild;
663  XmlNode nextSibling;
664  for (XmlNode xmlNode = firstChild; xmlNode != null; xmlNode = nextSibling)
665  {
666  nextSibling = xmlNode.NextSibling;
667  newChild.RemoveChild(xmlNode);
668  InsertAfter(xmlNode, refChild2);
669  refChild2 = xmlNode;
670  }
671  return firstChild;
672  }
673  if (!(newChild is XmlLinkedNode) || !IsValidChildType(newChild.NodeType))
674  {
675  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_TypeConflict"));
676  }
677  XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
678  XmlLinkedNode xmlLinkedNode2 = (XmlLinkedNode)refChild;
679  string value = newChild.Value;
680  XmlNodeChangedEventArgs eventArgs = GetEventArgs(newChild, newChild.ParentNode, this, value, value, XmlNodeChangedAction.Insert);
681  if (eventArgs != null)
682  {
683  BeforeEvent(eventArgs);
684  }
685  if (xmlLinkedNode2 == LastNode)
686  {
687  xmlLinkedNode.next = xmlLinkedNode2.next;
688  xmlLinkedNode2.next = xmlLinkedNode;
689  LastNode = xmlLinkedNode;
690  xmlLinkedNode.SetParent(this);
691  if (xmlLinkedNode2.IsText && xmlLinkedNode.IsText)
692  {
693  NestTextNodes(xmlLinkedNode2, xmlLinkedNode);
694  }
695  }
696  else
697  {
698  XmlLinkedNode xmlLinkedNode3 = xmlLinkedNode.next = xmlLinkedNode2.next;
699  xmlLinkedNode2.next = xmlLinkedNode;
700  xmlLinkedNode.SetParent(this);
701  if (xmlLinkedNode2.IsText)
702  {
703  if (xmlLinkedNode.IsText)
704  {
705  NestTextNodes(xmlLinkedNode2, xmlLinkedNode);
706  if (xmlLinkedNode3.IsText)
707  {
708  NestTextNodes(xmlLinkedNode, xmlLinkedNode3);
709  }
710  }
711  else if (xmlLinkedNode3.IsText)
712  {
713  UnnestTextNodes(xmlLinkedNode2, xmlLinkedNode3);
714  }
715  }
716  else if (xmlLinkedNode.IsText && xmlLinkedNode3.IsText)
717  {
718  NestTextNodes(xmlLinkedNode, xmlLinkedNode3);
719  }
720  }
721  if (eventArgs != null)
722  {
723  AfterEvent(eventArgs);
724  }
725  return xmlLinkedNode;
726  }
727 
734  public virtual XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild)
735  {
736  XmlNode nextSibling = oldChild.NextSibling;
737  RemoveChild(oldChild);
738  XmlNode xmlNode = InsertBefore(newChild, nextSibling);
739  return oldChild;
740  }
741 
746  public virtual XmlNode RemoveChild(XmlNode oldChild)
747  {
748  if (!IsContainer)
749  {
750  throw new InvalidOperationException(Res.GetString("Xdom_Node_Remove_Contain"));
751  }
752  if (oldChild.ParentNode != this)
753  {
754  throw new ArgumentException(Res.GetString("Xdom_Node_Remove_Child"));
755  }
756  XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)oldChild;
757  string value = xmlLinkedNode.Value;
758  XmlNodeChangedEventArgs eventArgs = GetEventArgs(xmlLinkedNode, this, null, value, value, XmlNodeChangedAction.Remove);
759  if (eventArgs != null)
760  {
761  BeforeEvent(eventArgs);
762  }
763  XmlLinkedNode lastNode = LastNode;
764  if (xmlLinkedNode == FirstChild)
765  {
766  if (xmlLinkedNode == lastNode)
767  {
768  LastNode = null;
769  xmlLinkedNode.next = null;
770  xmlLinkedNode.SetParent(null);
771  }
772  else
773  {
774  XmlLinkedNode next = xmlLinkedNode.next;
775  if (next.IsText && xmlLinkedNode.IsText)
776  {
777  UnnestTextNodes(xmlLinkedNode, next);
778  }
779  lastNode.next = next;
780  xmlLinkedNode.next = null;
781  xmlLinkedNode.SetParent(null);
782  }
783  }
784  else if (xmlLinkedNode == lastNode)
785  {
786  XmlLinkedNode xmlLinkedNode2 = (XmlLinkedNode)xmlLinkedNode.PreviousSibling;
787  xmlLinkedNode2.next = xmlLinkedNode.next;
788  LastNode = xmlLinkedNode2;
789  xmlLinkedNode.next = null;
790  xmlLinkedNode.SetParent(null);
791  }
792  else
793  {
794  XmlLinkedNode xmlLinkedNode3 = (XmlLinkedNode)xmlLinkedNode.PreviousSibling;
795  XmlLinkedNode next2 = xmlLinkedNode.next;
796  if (next2.IsText)
797  {
798  if (xmlLinkedNode3.IsText)
799  {
800  NestTextNodes(xmlLinkedNode3, next2);
801  }
802  else if (xmlLinkedNode.IsText)
803  {
804  UnnestTextNodes(xmlLinkedNode, next2);
805  }
806  }
807  xmlLinkedNode3.next = next2;
808  xmlLinkedNode.next = null;
809  xmlLinkedNode.SetParent(null);
810  }
811  if (eventArgs != null)
812  {
813  AfterEvent(eventArgs);
814  }
815  return oldChild;
816  }
817 
823  public virtual XmlNode PrependChild(XmlNode newChild)
824  {
825  return InsertBefore(newChild, FirstChild);
826  }
827 
833  public virtual XmlNode AppendChild(XmlNode newChild)
834  {
835  XmlDocument xmlDocument = OwnerDocument;
836  if (xmlDocument == null)
837  {
838  xmlDocument = (this as XmlDocument);
839  }
840  if (!IsContainer)
841  {
842  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Contain"));
843  }
844  if (this == newChild || AncestorNode(newChild))
845  {
846  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Child"));
847  }
848  if (newChild.ParentNode != null)
849  {
850  newChild.ParentNode.RemoveChild(newChild);
851  }
852  XmlDocument ownerDocument = newChild.OwnerDocument;
853  if (ownerDocument != null && ownerDocument != xmlDocument && ownerDocument != this)
854  {
855  throw new ArgumentException(Res.GetString("Xdom_Node_Insert_Context"));
856  }
857  if (newChild.NodeType == XmlNodeType.DocumentFragment)
858  {
859  XmlNode firstChild = newChild.FirstChild;
860  XmlNode nextSibling;
861  for (XmlNode xmlNode = firstChild; xmlNode != null; xmlNode = nextSibling)
862  {
863  nextSibling = xmlNode.NextSibling;
864  newChild.RemoveChild(xmlNode);
865  AppendChild(xmlNode);
866  }
867  return firstChild;
868  }
869  if (!(newChild is XmlLinkedNode) || !IsValidChildType(newChild.NodeType))
870  {
871  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_TypeConflict"));
872  }
873  if (!CanInsertAfter(newChild, LastChild))
874  {
875  throw new InvalidOperationException(Res.GetString("Xdom_Node_Insert_Location"));
876  }
877  string value = newChild.Value;
878  XmlNodeChangedEventArgs eventArgs = GetEventArgs(newChild, newChild.ParentNode, this, value, value, XmlNodeChangedAction.Insert);
879  if (eventArgs != null)
880  {
881  BeforeEvent(eventArgs);
882  }
883  XmlLinkedNode lastNode = LastNode;
884  XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
885  if (lastNode == null)
886  {
887  xmlLinkedNode.next = xmlLinkedNode;
888  LastNode = xmlLinkedNode;
889  xmlLinkedNode.SetParent(this);
890  }
891  else
892  {
893  xmlLinkedNode.next = lastNode.next;
894  lastNode.next = xmlLinkedNode;
895  LastNode = xmlLinkedNode;
896  xmlLinkedNode.SetParent(this);
897  if (lastNode.IsText && xmlLinkedNode.IsText)
898  {
899  NestTextNodes(lastNode, xmlLinkedNode);
900  }
901  }
902  if (eventArgs != null)
903  {
904  AfterEvent(eventArgs);
905  }
906  return xmlLinkedNode;
907  }
908 
909  internal virtual XmlNode AppendChildForLoad(XmlNode newChild, XmlDocument doc)
910  {
911  XmlNodeChangedEventArgs insertEventArgsForLoad = doc.GetInsertEventArgsForLoad(newChild, this);
912  if (insertEventArgsForLoad != null)
913  {
914  doc.BeforeEvent(insertEventArgsForLoad);
915  }
916  XmlLinkedNode lastNode = LastNode;
917  XmlLinkedNode xmlLinkedNode = (XmlLinkedNode)newChild;
918  if (lastNode == null)
919  {
920  xmlLinkedNode.next = xmlLinkedNode;
921  LastNode = xmlLinkedNode;
922  xmlLinkedNode.SetParentForLoad(this);
923  }
924  else
925  {
926  xmlLinkedNode.next = lastNode.next;
927  lastNode.next = xmlLinkedNode;
928  LastNode = xmlLinkedNode;
929  if (lastNode.IsText && xmlLinkedNode.IsText)
930  {
931  NestTextNodes(lastNode, xmlLinkedNode);
932  }
933  else
934  {
935  xmlLinkedNode.SetParentForLoad(this);
936  }
937  }
938  if (insertEventArgsForLoad != null)
939  {
940  doc.AfterEvent(insertEventArgsForLoad);
941  }
942  return xmlLinkedNode;
943  }
944 
945  internal virtual bool IsValidChildType(XmlNodeType type)
946  {
947  return false;
948  }
949 
950  internal virtual bool CanInsertBefore(XmlNode newChild, XmlNode refChild)
951  {
952  return true;
953  }
954 
955  internal virtual bool CanInsertAfter(XmlNode newChild, XmlNode refChild)
956  {
957  return true;
958  }
959 
965  public abstract XmlNode CloneNode(bool deep);
966 
967  internal virtual void CopyChildren(XmlDocument doc, XmlNode container, bool deep)
968  {
969  for (XmlNode xmlNode = container.FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
970  {
971  AppendChildForLoad(xmlNode.CloneNode(deep), doc);
972  }
973  }
974 
976  public virtual void Normalize()
977  {
978  XmlNode xmlNode = null;
979  StringBuilder stringBuilder = new StringBuilder();
980  XmlNode nextSibling;
981  for (XmlNode xmlNode2 = FirstChild; xmlNode2 != null; xmlNode2 = nextSibling)
982  {
983  nextSibling = xmlNode2.NextSibling;
984  switch (xmlNode2.NodeType)
985  {
986  case XmlNodeType.Text:
987  case XmlNodeType.Whitespace:
988  case XmlNodeType.SignificantWhitespace:
989  {
990  stringBuilder.Append(xmlNode2.Value);
991  XmlNode xmlNode3 = NormalizeWinner(xmlNode, xmlNode2);
992  if (xmlNode3 == xmlNode)
993  {
994  RemoveChild(xmlNode2);
995  continue;
996  }
997  if (xmlNode != null)
998  {
999  RemoveChild(xmlNode);
1000  }
1001  xmlNode = xmlNode2;
1002  continue;
1003  }
1004  case XmlNodeType.Element:
1005  xmlNode2.Normalize();
1006  break;
1007  }
1008  if (xmlNode != null)
1009  {
1010  xmlNode.Value = stringBuilder.ToString();
1011  xmlNode = null;
1012  }
1013  stringBuilder.Remove(0, stringBuilder.Length);
1014  }
1015  if (xmlNode != null && stringBuilder.Length > 0)
1016  {
1017  xmlNode.Value = stringBuilder.ToString();
1018  }
1019  }
1020 
1021  private XmlNode NormalizeWinner(XmlNode firstNode, XmlNode secondNode)
1022  {
1023  if (firstNode == null)
1024  {
1025  return secondNode;
1026  }
1027  if (firstNode.NodeType == XmlNodeType.Text)
1028  {
1029  return firstNode;
1030  }
1031  if (secondNode.NodeType == XmlNodeType.Text)
1032  {
1033  return secondNode;
1034  }
1035  if (firstNode.NodeType == XmlNodeType.SignificantWhitespace)
1036  {
1037  return firstNode;
1038  }
1039  if (secondNode.NodeType == XmlNodeType.SignificantWhitespace)
1040  {
1041  return secondNode;
1042  }
1043  if (firstNode.NodeType == XmlNodeType.Whitespace)
1044  {
1045  return firstNode;
1046  }
1047  if (secondNode.NodeType == XmlNodeType.Whitespace)
1048  {
1049  return secondNode;
1050  }
1051  return null;
1052  }
1053 
1059  public virtual bool Supports(string feature, string version)
1060  {
1061  if (string.Compare("XML", feature, StringComparison.OrdinalIgnoreCase) == 0 && (version == null || version == "1.0" || version == "2.0"))
1062  {
1063  return true;
1064  }
1065  return false;
1066  }
1067 
1068  internal static bool HasReadOnlyParent(XmlNode n)
1069  {
1070  while (n != null)
1071  {
1072  switch (n.NodeType)
1073  {
1074  case XmlNodeType.EntityReference:
1075  case XmlNodeType.Entity:
1076  return true;
1077  case XmlNodeType.Attribute:
1078  n = ((XmlAttribute)n).OwnerElement;
1079  break;
1080  default:
1081  n = n.ParentNode;
1082  break;
1083  }
1084  }
1085  return false;
1086  }
1087 
1090  public virtual XmlNode Clone()
1091  {
1092  return CloneNode(deep: true);
1093  }
1094 
1097  object ICloneable.Clone()
1098  {
1099  return CloneNode(deep: true);
1100  }
1101 
1105  {
1106  return new XmlChildEnumerator(this);
1107  }
1108 
1112  {
1113  return new XmlChildEnumerator(this);
1114  }
1115 
1116  private void AppendChildText(StringBuilder builder)
1117  {
1118  for (XmlNode xmlNode = FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
1119  {
1120  if (xmlNode.FirstChild == null)
1121  {
1122  if (xmlNode.NodeType == XmlNodeType.Text || xmlNode.NodeType == XmlNodeType.CDATA || xmlNode.NodeType == XmlNodeType.Whitespace || xmlNode.NodeType == XmlNodeType.SignificantWhitespace)
1123  {
1124  builder.Append(xmlNode.InnerText);
1125  }
1126  }
1127  else
1128  {
1129  xmlNode.AppendChildText(builder);
1130  }
1131  }
1132  }
1133 
1136  public abstract void WriteTo(XmlWriter w);
1137 
1140  public abstract void WriteContentTo(XmlWriter w);
1141 
1143  public virtual void RemoveAll()
1144  {
1145  XmlNode xmlNode = FirstChild;
1146  XmlNode xmlNode2 = null;
1147  while (xmlNode != null)
1148  {
1149  xmlNode2 = xmlNode.NextSibling;
1150  RemoveChild(xmlNode);
1151  xmlNode = xmlNode2;
1152  }
1153  }
1154 
1158  public virtual string GetNamespaceOfPrefix(string prefix)
1159  {
1160  string namespaceOfPrefixStrict = GetNamespaceOfPrefixStrict(prefix);
1161  if (namespaceOfPrefixStrict == null)
1162  {
1163  return string.Empty;
1164  }
1165  return namespaceOfPrefixStrict;
1166  }
1167 
1168  internal string GetNamespaceOfPrefixStrict(string prefix)
1169  {
1170  XmlDocument document = Document;
1171  if (document != null)
1172  {
1173  prefix = document.NameTable.Get(prefix);
1174  if (prefix == null)
1175  {
1176  return null;
1177  }
1178  XmlNode xmlNode = this;
1179  while (xmlNode != null)
1180  {
1181  if (xmlNode.NodeType == XmlNodeType.Element)
1182  {
1183  XmlElement xmlElement = (XmlElement)xmlNode;
1184  if (xmlElement.HasAttributes)
1185  {
1186  XmlAttributeCollection attributes = xmlElement.Attributes;
1187  if (prefix.Length == 0)
1188  {
1189  for (int i = 0; i < attributes.Count; i++)
1190  {
1191  XmlAttribute xmlAttribute = attributes[i];
1192  if (xmlAttribute.Prefix.Length == 0 && Ref.Equal(xmlAttribute.LocalName, document.strXmlns))
1193  {
1194  return xmlAttribute.Value;
1195  }
1196  }
1197  }
1198  else
1199  {
1200  for (int j = 0; j < attributes.Count; j++)
1201  {
1202  XmlAttribute xmlAttribute2 = attributes[j];
1203  if (Ref.Equal(xmlAttribute2.Prefix, document.strXmlns))
1204  {
1205  if (Ref.Equal(xmlAttribute2.LocalName, prefix))
1206  {
1207  return xmlAttribute2.Value;
1208  }
1209  }
1210  else if (Ref.Equal(xmlAttribute2.Prefix, prefix))
1211  {
1212  return xmlAttribute2.NamespaceURI;
1213  }
1214  }
1215  }
1216  }
1217  if (Ref.Equal(xmlNode.Prefix, prefix))
1218  {
1219  return xmlNode.NamespaceURI;
1220  }
1221  xmlNode = xmlNode.ParentNode;
1222  }
1223  else
1224  {
1225  xmlNode = ((xmlNode.NodeType != XmlNodeType.Attribute) ? xmlNode.ParentNode : ((XmlAttribute)xmlNode).OwnerElement);
1226  }
1227  }
1228  if (Ref.Equal(document.strXml, prefix))
1229  {
1230  return document.strReservedXml;
1231  }
1232  if (Ref.Equal(document.strXmlns, prefix))
1233  {
1234  return document.strReservedXmlns;
1235  }
1236  }
1237  return null;
1238  }
1239 
1243  public virtual string GetPrefixOfNamespace(string namespaceURI)
1244  {
1245  string prefixOfNamespaceStrict = GetPrefixOfNamespaceStrict(namespaceURI);
1246  if (prefixOfNamespaceStrict == null)
1247  {
1248  return string.Empty;
1249  }
1250  return prefixOfNamespaceStrict;
1251  }
1252 
1253  internal string GetPrefixOfNamespaceStrict(string namespaceURI)
1254  {
1255  XmlDocument document = Document;
1256  if (document != null)
1257  {
1258  namespaceURI = document.NameTable.Add(namespaceURI);
1259  XmlNode xmlNode = this;
1260  while (xmlNode != null)
1261  {
1262  if (xmlNode.NodeType == XmlNodeType.Element)
1263  {
1264  XmlElement xmlElement = (XmlElement)xmlNode;
1265  if (xmlElement.HasAttributes)
1266  {
1267  XmlAttributeCollection attributes = xmlElement.Attributes;
1268  for (int i = 0; i < attributes.Count; i++)
1269  {
1270  XmlAttribute xmlAttribute = attributes[i];
1271  if (xmlAttribute.Prefix.Length == 0)
1272  {
1273  if (Ref.Equal(xmlAttribute.LocalName, document.strXmlns) && xmlAttribute.Value == namespaceURI)
1274  {
1275  return string.Empty;
1276  }
1277  }
1278  else if (Ref.Equal(xmlAttribute.Prefix, document.strXmlns))
1279  {
1280  if (xmlAttribute.Value == namespaceURI)
1281  {
1282  return xmlAttribute.LocalName;
1283  }
1284  }
1285  else if (Ref.Equal(xmlAttribute.NamespaceURI, namespaceURI))
1286  {
1287  return xmlAttribute.Prefix;
1288  }
1289  }
1290  }
1291  if (Ref.Equal(xmlNode.NamespaceURI, namespaceURI))
1292  {
1293  return xmlNode.Prefix;
1294  }
1295  xmlNode = xmlNode.ParentNode;
1296  }
1297  else
1298  {
1299  xmlNode = ((xmlNode.NodeType != XmlNodeType.Attribute) ? xmlNode.ParentNode : ((XmlAttribute)xmlNode).OwnerElement);
1300  }
1301  }
1302  if (Ref.Equal(document.strReservedXml, namespaceURI))
1303  {
1304  return document.strXml;
1305  }
1306  if (Ref.Equal(document.strReservedXmlns, namespaceURI))
1307  {
1308  return document.strXmlns;
1309  }
1310  }
1311  return null;
1312  }
1313 
1314  internal virtual void SetParent(XmlNode node)
1315  {
1316  if (node == null)
1317  {
1318  parentNode = OwnerDocument;
1319  }
1320  else
1321  {
1322  parentNode = node;
1323  }
1324  }
1325 
1326  internal virtual void SetParentForLoad(XmlNode node)
1327  {
1328  parentNode = node;
1329  }
1330 
1331  internal static void SplitName(string name, out string prefix, out string localName)
1332  {
1333  int num = name.IndexOf(':');
1334  if (-1 == num || num == 0 || name.Length - 1 == num)
1335  {
1336  prefix = string.Empty;
1337  localName = name;
1338  }
1339  else
1340  {
1341  prefix = name.Substring(0, num);
1342  localName = name.Substring(num + 1);
1343  }
1344  }
1345 
1346  internal virtual XmlNode FindChild(XmlNodeType type)
1347  {
1348  for (XmlNode xmlNode = FirstChild; xmlNode != null; xmlNode = xmlNode.NextSibling)
1349  {
1350  if (xmlNode.NodeType == type)
1351  {
1352  return xmlNode;
1353  }
1354  }
1355  return null;
1356  }
1357 
1358  internal virtual XmlNodeChangedEventArgs GetEventArgs(XmlNode node, XmlNode oldParent, XmlNode newParent, string oldValue, string newValue, XmlNodeChangedAction action)
1359  {
1360  XmlDocument ownerDocument = OwnerDocument;
1361  if (ownerDocument != null)
1362  {
1363  if (!ownerDocument.IsLoading && ((newParent != null && newParent.IsReadOnly) || (oldParent != null && oldParent.IsReadOnly)))
1364  {
1365  throw new InvalidOperationException(Res.GetString("Xdom_Node_Modify_ReadOnly"));
1366  }
1367  return ownerDocument.GetEventArgs(node, oldParent, newParent, oldValue, newValue, action);
1368  }
1369  return null;
1370  }
1371 
1372  internal virtual void BeforeEvent(XmlNodeChangedEventArgs args)
1373  {
1374  if (args != null)
1375  {
1376  OwnerDocument.BeforeEvent(args);
1377  }
1378  }
1379 
1380  internal virtual void AfterEvent(XmlNodeChangedEventArgs args)
1381  {
1382  if (args != null)
1383  {
1384  OwnerDocument.AfterEvent(args);
1385  }
1386  }
1387 
1388  internal virtual string GetXPAttribute(string localName, string namespaceURI)
1389  {
1390  return string.Empty;
1391  }
1392 
1393  internal static void NestTextNodes(XmlNode prevNode, XmlNode nextNode)
1394  {
1395  nextNode.parentNode = prevNode;
1396  }
1397 
1398  internal static void UnnestTextNodes(XmlNode prevNode, XmlNode nextNode)
1399  {
1400  nextNode.parentNode = prevNode.ParentNode;
1401  }
1402  }
1403 }
virtual XPathNodeIterator Select(string xpath)
Selects a node set, using the specified XPath expression.
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
Represents an XML document. You can use this class to load, validate, edit, add, and position XML in ...
Definition: XmlDocument.cs:13
virtual string OuterXml
Gets the markup containing this node and all its child nodes.
Definition: XmlNode.cs:222
abstract string LocalName
Gets the local name of the node, when overridden in a derived class.
Definition: XmlNode.cs:163
object Clone()
Creates a new object that is a copy of the current instance.
IEnumerator GetEnumerator()
Get an enumerator that iterates through the child nodes in the current node.
Definition: XmlNode.cs:1111
Defines the post-schema-validation infoset of a validated XML node.
virtual XmlNode PreviousText
Gets the text node that immediately precedes this node.
Definition: XmlNode.cs:397
virtual XmlNode ParentNode
Gets the parent of this node (for nodes that can have parents).
Definition: XmlNode.cs:60
Represents an ordered collection of nodes.
Definition: XmlNodeList.cs:7
XmlNameTable NameTable
Gets the T:System.Xml.XmlNameTable associated with this implementation.
Definition: XmlDocument.cs:230
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
virtual XmlDocument OwnerDocument
Gets the T:System.Xml.XmlDocument to which this node belongs.
Definition: XmlNode.cs:104
abstract void WriteTo(XmlWriter w)
Saves the current node to the specified T:System.Xml.XmlWriter, when overridden in a derived class.
Implements a T:System.IO.TextWriter for writing information to a string. The information is stored in...
Definition: StringWriter.cs:13
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
virtual void Normalize()
Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form...
Definition: XmlNode.cs:976
virtual XmlNode ReplaceChild(XmlNode newChild, XmlNode oldChild)
Replaces the child node oldChild with newChild node.
Definition: XmlNode.cs:734
virtual XmlNode LastChild
Gets the last child of the node.
Definition: XmlNode.cs:121
override XPathNavigator CreateNavigator()
Creates a new T:System.Xml.XPath.XPathNavigator object for navigating this document.
Definition: XmlDocument.cs:957
Definition: __Canon.cs:3
Represents an attribute. Valid and default values for the attribute are defined in a document type de...
Definition: XmlAttribute.cs:7
Represents an entity reference node.
abstract void WriteContentTo(XmlWriter w)
Saves all the child nodes of the node to the specified T:System.Xml.XmlWriter, when overridden in a d...
virtual XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
Inserts the specified node immediately before the specified reference node.
Definition: XmlNode.cs:514
XmlNode SelectSingleNode(string xpath)
Selects the first XmlNode that matches the XPath expression.
Definition: XmlNode.cs:431
virtual bool IsReadOnly
Gets a value indicating whether the node is read-only.
Definition: XmlNode.cs:171
XmlNodeType
Specifies the type of node.
Definition: XmlNodeType.cs:5
virtual XmlNode PrependChild(XmlNode newChild)
Adds the specified node to the beginning of the list of child nodes for this node.
Definition: XmlNode.cs:823
XPathNodeType
Defines the XPath node types that can be returned from the T:System.Xml.XPath.XPathNavigator class.
Definition: XPathNodeType.cs:4
override XmlNode PreviousSibling
Gets the node immediately preceding this node.
virtual string NamespaceURI
Gets the namespace URI of this node.
Definition: XmlNode.cs:143
virtual bool HasChildNodes
Gets a value indicating whether this node has any child nodes.
Definition: XmlNode.cs:139
virtual string GetAttribute(string name)
Returns the value for the attribute with the specified name.
Definition: XmlElement.cs:327
Provides data for the E:System.Xml.XmlDocument.NodeChanged, E:System.Xml.XmlDocument....
virtual XmlText CreateTextNode(string text)
Creates an T:System.Xml.XmlText with the specified text.
Definition: XmlDocument.cs:942
abstract string Get(char[] array, int offset, int length)
When overridden in a derived class, gets the atomized string containing the same characters as the sp...
override string NamespaceURI
Gets the namespace URI of this node.
Definition: XmlAttribute.cs:41
Provides an accessor to the T:System.Xml.XPath.XPathNavigator class.
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
Definition: IEnumerable.cs:9
virtual XmlNode Clone()
Creates a duplicate of this node.
Definition: XmlNode.cs:1090
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
override string ToString()
Returns a string containing the characters written to the current StringWriter so far.
virtual bool HasAttribute(string name)
Determines whether the current node has an attribute with the specified name.
Definition: XmlElement.cs:516
abstract void SetContext(XmlNamespaceManager nsManager)
When overridden in a derived class, specifies the T:System.Xml.XmlNamespaceManager object to use for ...
Gets the node immediately preceding or following this node.
Definition: XmlLinkedNode.cs:4
XmlNodeChangedAction
Specifies the type of node change.
Provides a typed class that represents a compiled XPath expression.
virtual string BaseURI
Gets the base URI of the current node.
Definition: XmlNode.cs:273
virtual string InnerXml
Gets or sets the markup representing only the child nodes of this node.
Definition: XmlNode.cs:245
Resolves, adds, and removes namespaces to a collection and provides scope management for these namesp...
int Length
Gets or sets the length of the current T:System.Text.StringBuilder object.
virtual string Value
Gets or sets the value of the node.
Definition: XmlNode.cs:36
Supports cloning, which creates a new instance of a class with the same value as an existing instance...
Definition: ICloneable.cs:7
virtual bool HasAttributes
Gets a boolean value indicating whether the current node has any attributes.
Definition: XmlElement.cs:135
Represents an element.
Definition: XmlElement.cs:7
virtual XPathNavigator CreateNavigator()
Creates an T:System.Xml.XPath.XPathNavigator for navigating this object.
Definition: XmlNode.cs:416
IEnumerator GetEnumerator()
Returns an enumerator that iterates through a collection.
virtual bool Supports(string feature, string version)
Tests if the DOM implementation implements a specific feature.
Definition: XmlNode.cs:1059
virtual string Prefix
Gets or sets the namespace prefix of this node.
Definition: XmlNode.cs:150
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
virtual XmlNodeList ChildNodes
Gets all the child nodes of the node.
Definition: XmlNode.cs:87
The exception that is thrown when one of the arguments provided to a method is not valid.
override string LocalName
Gets the local name of the node.
Definition: XmlAttribute.cs:37
abstract string Add(char[] array, int offset, int length)
When overridden in a derived class, atomizes the specified string and adds it to the XmlNameTable.
virtual XmlNode RemoveChild(XmlNode oldChild)
Removes specified child node.
Definition: XmlNode.cs:746
abstract XmlNode CloneNode(bool deep)
Creates a duplicate of the node, when overridden in a derived class.
virtual XmlNode FirstChild
Gets the first child of the node.
Definition: XmlNode.cs:117
Provides a cursor model for navigating and editing XML data.
virtual XmlNode AppendChild(XmlNode newChild)
Adds the specified node to the end of the list of child nodes, of this node.
Definition: XmlNode.cs:833
virtual string GetNamespaceOfPrefix(string prefix)
Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and...
Definition: XmlNode.cs:1158
Represents a collection of attributes that can be accessed by name or index.
The exception that is thrown when a method call is invalid for the object's current state.
XmlNodeList SelectNodes(string xpath, XmlNamespaceManager nsmgr)
Selects a list of nodes matching the XPath expression. Any prefixes found in the XPath expression are...
Definition: XmlNode.cs:472
virtual string GetPrefixOfNamespace(string namespaceURI)
Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current n...
Definition: XmlNode.cs:1243
virtual XmlNode NextSibling
Gets the node immediately following this node.
Definition: XmlNode.cs:95
virtual void RemoveAll()
Removes all the child nodes and/or attributes of the current node.
Definition: XmlNode.cs:1143
XmlSpace
Specifies the current xml:space scope.
Definition: XmlSpace.cs:5
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
virtual string InnerText
Gets or sets the concatenated values of the node and all its child nodes.
Definition: XmlNode.cs:182
virtual XPathExpression Compile(string xpath)
Compiles a string representing an XPath expression and returns an T:System.Xml.XPath....
virtual XmlNode InsertAfter(XmlNode newChild, XmlNode refChild)
Inserts the specified node immediately after the specified reference node.
Definition: XmlNode.cs:623
override string Value
Gets or sets the value of the node.
Definition: XmlAttribute.cs:71
override string Prefix
Gets or sets the namespace prefix of this node.
Definition: XmlAttribute.cs:48
virtual XmlNode PreviousSibling
Gets the node immediately preceding this node.
Definition: XmlNode.cs:91
override XmlAttributeCollection Attributes
Gets an T:System.Xml.XmlAttributeCollection containing the list of attributes for this node.
Definition: XmlElement.cs:114
XmlNode SelectSingleNode(string xpath, XmlNamespaceManager nsmgr)
Selects the first XmlNode that matches the XPath expression. Any prefixes found in the XPath expressi...
Definition: XmlNode.cs:441
XmlNodeList SelectNodes(string xpath)
Selects a list of nodes matching the XPath expression.
Definition: XmlNode.cs:457
Represents a single node in the XML document.
Definition: XmlNode.cs:13
abstract string Name
Gets the qualified name of the node, when overridden in a derived class.
Definition: XmlNode.cs:20
Supports a simple iteration over a non-generic collection.
Definition: IEnumerator.cs:9
abstract XmlNodeType NodeType
Gets the type of the current node, when overridden in a derived class.
Definition: XmlNode.cs:53
virtual IXmlSchemaInfo SchemaInfo
Gets the post schema validation infoset that has been assigned to this node as a result of schema val...
Definition: XmlNode.cs:268
StringBuilder Remove(int startIndex, int length)
Removes the specified range of characters from this instance.
Encodes and decodes XML names, and provides methods for converting between common language runtime ty...
Definition: XmlConvert.cs:11
virtual XmlAttributeCollection Attributes
Gets an T:System.Xml.XmlAttributeCollection containing the attributes of this node.
Definition: XmlNode.cs:99