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

XmlDocumentSchema クラス

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

XmlDocument の構造体またはスキーマ表します。このクラス継承できません。

名前空間: System.Web.UI.Design
アセンブリ: System.Design (system.design.dll 内)
構文構文

Public NotInheritable Class
 XmlDocumentSchema
    Implements IDataSourceSchema
Dim instance As XmlDocumentSchema
public sealed class XmlDocumentSchema : IDataSourceSchema
public ref class XmlDocumentSchema sealed :
 IDataSourceSchema
public final class XmlDocumentSchema implements
 IDataSourceSchema
public final class XmlDocumentSchema implements
 IDataSourceSchema
解説解説
使用例使用例

XmlDocumentSchema オブジェクト使用して XML ドキュメント構造体を TreeView コントロール表示する方法次のコード例示します

Imports Microsoft.VisualBasic
Imports System.Xml
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design

Public Class XmlDocumentSchemaSample

    ' This method fills a TreeView Web control from an XML file.
    Public Sub FillTreeView(ByVal
 treeVw As TreeView, ByVal fileName As
 String)
        ' Get a reference to the current HttpContext
        Dim currentContext As HttpContext =
 HttpContext.Current
        Dim i, j, k As Integer
        Dim CurNode, NewNode As TreeNode

        ' Create and load an XML document
        Dim XDoc As New
 XmlDocument()
        XDoc.Load(currentContext.Server.MapPath(fileName))

        ' Get a map of the XML Document
        Dim xSchema As New
 XmlDocumentSchema(XDoc, "")

        ' Get a list of the root child views
        Dim RootViews As IDataSourceViewSchema()
 = xSchema.GetViews()

        ' Add each child to the TreeView
        For i = 0 To RootViews.Length - 1
            NewNode = New TreeNode(RootViews(i).Name)
            treeVw.Nodes.Add(NewNode)
            CurNode = treeVw.Nodes(i)

            ' Get a list of children of this child
            Dim ChildViews As IDataSourceViewSchema()
 = RootViews(i).GetChildren()

            ' Add each child to the child node of the TreeView
            For j = 0 To ChildViews.Length
 - 1
                NewNode = New TreeNode(ChildViews(j).Name)
                CurNode.ChildNodes.Add(NewNode)
                CurNode = CurNode.ChildNodes(j)

                ' Get a list of children of this child
                Dim ChildVws As IDataSourceViewSchema()
 = ChildViews(j).GetChildren()
                ' Add each child to the child node
                For k = 0 To ChildVws.Length
 - 1
                    NewNode = New TreeNode(ChildVws(k).Name)
                    CurNode.ChildNodes.Add(NewNode)
                Next
                ' Select the parent of the current child
                CurNode = CurNode.Parent
            Next
            ' Select the parent of the current child
            CurNode = CurNode.Parent
        Next
    End Sub
End Class
// This method fills a TreeView Web control from an XML file.
public void FillTreeView(TreeView treeVw, string
 fileName)
{
    // Get a reference to the current HttpContext
    HttpContext currentContext = HttpContext.Current;
    int i, j, k;
    TreeNode CurNode, NewNode;

    // Create and load an XML document
    XmlDocument XDoc = new XmlDocument();
    XDoc.Load(currentContext.Server.MapPath(fileName));

    // Get a map of the XML Document
    XmlDocumentSchema xSchema = new XmlDocumentSchema(XDoc, "");

    // Get a list of the root child views
    IDataSourceViewSchema[] RootViews = xSchema.GetViews();

    // Add each child to the TreeView
    for (i = 0; i < RootViews.Length; i++)
    {
        NewNode = new TreeNode(RootViews[i].Name);
        treeVw.Nodes.Add(NewNode);
        CurNode = treeVw.Nodes[i];

        // Get a list of children of this child
        IDataSourceViewSchema[] ChildViews = RootViews[i].GetChildren();
        // Add each child to the child node of the TreeView
        for (j = 0; j < ChildViews.Length; j++)
        {
            NewNode = new TreeNode(ChildViews[j].Name);
            CurNode.ChildNodes.Add(NewNode);
            CurNode = CurNode.ChildNodes[j];

            // Get a list of children of this child
            IDataSourceViewSchema[] ChildVws = ChildViews[j].GetChildren();
            // Add each child to the child node
            for (k = 0; k < ChildVws.Length; k++)
            {
                NewNode = new TreeNode(ChildVws[k].Name);
                CurNode.ChildNodes.Add(NewNode);
            }
            // Select the parent of the current child
            CurNode = CurNode.Parent;
        }
        // Select the parent of the current child
        CurNode = CurNode.Parent;
    }
}
継承階層継承階層
System.Object
  System.Web.UI.Design.XmlDocumentSchema
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
XmlDocumentSchema メンバ
System.Web.UI.Design 名前空間
XmlDocument
IDataSourceSchema インターフェイス
その他の技術情報
デザインサポート拡張



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

辞書ショートカット

すべての辞書の索引

「XmlDocumentSchema クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS