Re: Problem displaying XML in a datagrid
From: Dino Chiesa [Microsoft] (dinoch_at_online.microsoft.com)
Date: 07/28/04
- Next message: Dino Chiesa [Microsoft]: "Re: XML Serialization"
- Previous message: Dino Chiesa [Microsoft]: "Re: Looking for Advice"
- In reply to: James W: "RE: Problem displaying XML in a datagrid"
- Next in thread: James W: "Re: Problem displaying XML in a datagrid"
- Reply: James W: "Re: Problem displaying XML in a datagrid"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 27 Jul 2004 21:17:15 -0400
seems like bad XML.
I would transform it.
to something like
<plugins>
<plugin flavor="A">
<property1>...</...>
</plugin>
<plugin flavor="B">
...
...
But that's just me.
Once you have it in a more reasonable shape, then displaying it in a
datagrid (or loading it into a dataset) is much easier.
-D
"James W" <JamesW@discussions.microsoft.com> wrote in message
news:ABA23B1E-EEB1-42AF-8766-867A84C1AD31@microsoft.com...
> I should mention - I have no experience with XML Schemas, though I suspect
that a schema might solve the problem. Thoughts?
>
> "James W" wrote:
>
> > Hello all,
> >
> > I have some XML that is serialized from a registry hive, and is in the
format:
> >
> > <plugins>
> > <pluginA>
> > <property1>foo</property1>
> > <property2>bar</property2>
> > ...
> > </pluginA>
> > <pluginB>
> > <property1>oof</property1>
> > <property2>rab</property2>
> > ...
> > </pluginB>
> > ....
> > </plugins>
> >
> > The plugin-level nodes are named uniquely and I cannot control their
names or know how many there are. The property nodes have known names and
quantities.
> >
> > I am trying to load this into a dataset for display in a datagrid where
each property is displayed in a column. From what I am able to determine,
doing a SetDataBinding using the plugins node and using property nodes as
DataColumns will only display the first plugin node's properties.
> >
> > My question is, is there a way to tell the datagrid or dataset to
'ignore' the plugin node name differences so that it will display properly?
> >
> > My two possible workarounds are one to transform the xml to standardize
the plugin node names, or to manually crawl the XML, doing a
DataTable.Rows.Add() using the property node names and values. The first
seems easier than the second, but neither is particularly appealing.
> >
> > Anyone know of a way to get a dataset/datagrid to correctly display XML
of the type I have?
- Next message: Dino Chiesa [Microsoft]: "Re: XML Serialization"
- Previous message: Dino Chiesa [Microsoft]: "Re: Looking for Advice"
- In reply to: James W: "RE: Problem displaying XML in a datagrid"
- Next in thread: James W: "Re: Problem displaying XML in a datagrid"
- Reply: James W: "Re: Problem displaying XML in a datagrid"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|