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

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > 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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlElementCollection クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlElementCollection クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlElementCollection クラス を検索

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

辞書ショートカット

すべての辞書の索引

「HtmlElementCollection クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS