HtmlElementCollectionとは? わかりやすく解説

HtmlElementCollection クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

HtmlElement オブジェクトコレクション定義します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public NotInheritable Class
 HtmlElementCollection
    Implements ICollection, IEnumerable
Dim instance As HtmlElementCollection
public sealed class HtmlElementCollection :
 ICollection, IEnumerable
public ref class HtmlElementCollection sealed
 : ICollection, IEnumerable
public final class HtmlElementCollection implements
 ICollection, IEnumerable
public final class HtmlElementCollection implements
 ICollection, IEnumerable
使用例使用例

HtmlElementCollection オブジェクト使用してページドキュメント オブジェクト モデル (DOM) のテキスト表現出力するコード例次に示します

private void PrintDomBegin()
{
    if (webBrowser1.Document != null)
    {
        HtmlElementCollection elemColl = null;
        HtmlDocument doc = webBrowser1.Document;
        if (doc != null)
        {
            elemColl = doc.GetElementsByTagName("HTML");
            String str = PrintDom(elemColl, new System.Text.StringBuilder(),
 0);
            webBrowser1.DocumentText = str;
        }
    }
}

private string PrintDom(HtmlElementCollection
 elemColl, System.Text.StringBuilder returnStr, Int32 depth)
{
    System.Text.StringBuilder str = new System.Text.StringBuilder();

    foreach (HtmlElement elem in elemColl)
    {
        string elemName;

        elemName = elem.GetAttribute("ID");
        if (elemName == null || elemName.Length
 == 0)
        {
            elemName = elem.GetAttribute("name");
            if (elemName == null || elemName.Length
 == 0)
            {
                elemName = "<no name>";
            }
        }

        str.Append(' ', depth * 4);
        str.Append(elemName + ": " + elem.TagName + "(Level "
 + depth + ")");
        returnStr.AppendLine(str.ToString());

        if (elem.CanHaveChildren)
        {
            PrintDom(elem.Children, returnStr, depth + 1);
        }

        str.Remove(0, str.Length);
    }

    return(returnStr.ToString());
}
継承階層継承階層
System.Object
  System.Windows.Forms.HtmlElementCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

HtmlElementCollection プロパティ


パブリック プロパティパブリック プロパティ

明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.IsSynchronized  
インターフェイスの明示的な実装 System.Collections.ICollection.SyncRoot  
参照参照

関連項目

HtmlElementCollection クラス
System.Windows.Forms 名前空間

HtmlElementCollection メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo コレクション要素ArrayコピーしますArray特定のインデックスからコピー開始されます。
参照参照

関連項目

HtmlElementCollection クラス
System.Windows.Forms 名前空間

HtmlElementCollection メンバ

HtmlElement オブジェクトコレクション定義します

HtmlElementCollection データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
明示的インターフェイスの実装明示的インターフェイス実装
  名前 説明
インターフェイスの明示的な実装 System.Collections.ICollection.CopyTo コレクション要素ArrayコピーしますArray特定のインデックスからコピー開始されます。
インターフェイスの明示的な実装 System.Collections.ICollection.IsSynchronized  
インターフェイスの明示的な実装 System.Collections.ICollection.SyncRoot  
参照参照

関連項目

HtmlElementCollection クラス
System.Windows.Forms 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HtmlElementCollection」の関連用語

HtmlElementCollectionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlElementCollectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS