XmlNodeList

<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
Returns an XmlNodeList containing a list of all descendant elements that match the specified name.

Overload List
Returns an XmlNodeList containing a list of all descendant elements that match the specified Name.

[Visual Basic] Overloads Overridable Public Function GetElementsByTagName(String) As XmlNodeList
[C#] public virtual XmlNodeList GetElementsByTagName(string);
[C++] public: virtual XmlNodeList* GetElementsByTagName(String*);
[JScript] public function GetElementsByTagName(String) : XmlNodeList;
Returns an XmlNodeList containing a list of all descendant elements that match the specified LocalName and NamespaceURI.

[Visual Basic] Overloads Overridable Public Function GetElementsByTagName(String, String) As XmlNodeList
[C#] public virtual XmlNodeList GetElementsByTagName(string, string);
[C++] public: virtual XmlNodeList* GetElementsByTagName(String*, String*);
[JScript] public function GetElementsByTagName(String, String) : XmlNodeList;
Example
[Visual Basic, C#] The following example creates a XmlDocument object and uses the GetElmentsByTagName method and the resulting XmlNodeList object to display all the book titles.

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of GetElementsByTagName. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Option Explicit
Option Strict

Imports System
Imports System.IO
Imports System.Xml

Public Class Sample
    
    Public Shared Sub Main()
        'Create the XmlDocument.
        Dim doc As New XmlDocument()
        doc.Load("books.xml")
        
        'Display all the book titles.
        Dim elemList As XmlNodeList = doc.GetElementsByTagName("title")
        Dim i As Integer
        For i = 0 To elemList.Count - 1
            Console.WriteLine(elemList(i).InnerXml)
        Next i
    End Sub 'Main
End Class 'Sample
[C#]


using System;
using System.IO;
using System.Xml;

public class Sample
{
  public static void Main()
  {
    //Create the XmlDocument.
    XmlDocument doc = new XmlDocument();
    doc.Load("books.xml");

    //Display all the book titles.
    XmlNodeList elemList = doc.GetElementsByTagName("title");
    for (int i=0; i < elemList.Count; i++)
    {   
      Console.WriteLine(elemList[i].InnerXml);
    }  

  }
}
[C++, JScript] No example is available in C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button  in the upper-left corner of the page.<

seover="window.status='正文--XmlNodeList';return true">
<script type="text/javascript"> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值