欢迎光临
我们一直在努力

XmlNodeList-.NET教程,Asp.Net开发

建站超值云服务器,限时71元/月

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.
 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » XmlNodeList-.NET教程,Asp.Net开发
分享到: 更多 (0)