Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to read xsd into treeview
Message
De
17/11/2004 10:49:35
 
Information générale
Forum:
ASP.NET
Catégorie:
XML
Divers
Thread ID:
00962045
Message ID:
00962217
Vues:
7
Vincent,

Try reading the xml schema into a DataSet, then you can just iterate through the column names to build your TreeView. This should get you started:
DataSet ds = new DataSet()
ds.ReadXml("MyXMLFile.xml", XmlReadMode.ReadSchema);

TreeView oTree = new TreeView();
TreeNode oNode;

// First add the Root Node
TreeNode RootNode = new TreeNode();
RootNode.Text = "Column Names";
oTree.Nodes.Add(RootNode);
oTree.ExpandAll();

for (int i=0; i < ds.Tables[0].Columns.Count; i ++)
{
    node = new TreeNode();
    node.Text = ds.Tables[0].Columns[i].ColumnName;
    RootNode.Nodes.Add(node);    
}
~~Bonnie



>hi all,
>
>I need a help that how to read a xml schema file into treeview component to show the table strucuture. After that I can drag drop the field name into datagrid to display the data.
>
>Thank you.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform