XML to DataSets

L

lgbjr

Hi All,

I've been given an XML file (12 MB) that I need to extract data from. The
XML file makes the data easy to view, but the data is impossible to analyze
in its current format. I've looked at lots of XMLTextReader stuff and I
can't seem to figure out how to extract the info that I want. Here's a quick
example of the XML format:

<instance identity="A1" name="A1" type="A_Type">
<attribute Name="AttA1-1">
<value>
X
</value>
</attribute>
<instance identity="B1" name="B1" type="B_Type">
<attribute Name="AttB1-1">
<value>
X
</value>
</attribute>
<instance identity="B2" name="B2" type="B_Type">
<attribute Name="AttB2-1">
<value>
X
</value>
</attribute>
<instance identity="C1" name="C1" type="C_Type">
<attribute Name="AttC1-1">
<value>
X
</value>
</attribute>
</instance>
</instance>
</instance>
</instance>

Each A_Type contains several B_Types, and each B_Type contains several
C_Types and the file contains lots of A_Types. I've shown one attribute
each, but there are lots of them for each type!

what I'd like to do is load this data into a few tables with Master-Detail
Releations. So Table A would contain a row for each A_Type plus it's
attributes (with the Attribute Name as the Column Header). For a given row
selected in Table A, Table B would show each of the B_Types and it's
attributes, etc.

So, is there an easy way to get the data from the file using an
XMLTextReader or some other nifty XML tool, or is this going to be a brute
force method with regular expressions and do loops?

I'm not sure if I've supplied enough info, so if you need to know something
else before you can give me an answer, please let me know!! If it's going to
be brute force, that's fine, but I'd hate to spend a few days coding, only
later to find out that there was a quick way to do this!

TIA
Lee
 
C

Cor Ligthert

lgbjr,

You can always try to open it as file in your IDE, than you get than some
information.

Cor
 
L

lgbjr

Cor,

this I understand. I can open the document in IE, I can import it into
Excel, but in both cases, the format is nice for viewing, but not for data
analysis. the way the data is presented is tabular, rather than columnar.
So, If I want to look at a particular attribute for each Type_C, I have lots
of scrolling up and down to compare the values. Understand?

what I need is to convert the XML file to a dataset, with a table for each
Type, columns for each atrribute in the Type, and rows for each instance of
the Type.

I have found lots of information for creating an XML document from an
existing Dataset, but have not had any luck finding anything regarding
creating a dataset from an existing XML document. I know I can do this
manually (going through the file, finding all of the Types (tables), and
attributes (columns), but I was hoping that there was a tool available that
would do this for me (Input to the tool would be the XML document, the
output would be a dataset) Or I'd be happy with an MDB file or SQL DB,
though I really only need the dataset since the data is already stored on
disk in the XML file (No need to store the data in 2 locations!)

Once I have the dataset, I can "Load" the XML document into the dataset and
do whatever analysis that is required. What I'd like to be able to do is to
dynamically generate the dataset (Step 1 - read the XML file and generate
the dataset, Step 2 - load the data from the XML file into the dataset). Is
there a tool that can do this. Can VB.NET do this? Or do I have to manually
create the dataset first, then load the data from the XML file?

TIA
Lee
 
C

Cor Ligthert

lgbjr,

Did you do in your solution explorere: add existing item, choose XML , and
than browse to your XLM file?

Cor
 
L

lgbjr

Cor,

Sure, that's not a problem. I can open the XML file in the viewer and what I
see (because I can't use an XSLT file) is the XML code similar to what I
type in my first post.

But, unfortunately, this doesn't get me any closer to getting the data from
the XML file into a dataset.

cheers
Lee
 
D

Doug Taylor

Cor,

Sure, that's not a problem. I can open the XML file in the viewer and what I
see (because I can't use an XSLT file) is the XML code similar to what I
type in my first post.

But, unfortunately, this doesn't get me any closer to getting the data from
the XML file into a dataset.

Once opened in the explorer if it is well formed XML, you should be
able to right click and get it to to create a schema for the XML, once
you have a schema, (may be label view data) it is easy to read it in
to a dataset.

Doug Taylor
 
J

Jay B. Harlow [MVP - Outlook]

lgbjr,
I would consider using an XSLT transform to transform your input data into
something a little more DataSet friendly. Here is the start of such a
transform:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- handle the document/root node of the input -->
<xsl:template match="/">
<xsl:element name="lbgjr">
<xsl:apply-templates select="*" />
</xsl:element>
</xsl:template>
<!-- convert each instance node into a node that is the same as the Type
attribute -->
<!-- from: -->
<!-- <instance identity="A1" name="A1" type="A_Type"> -->
<!-- <instance identity="B1" name="B1" type="B_Type"> -->
<!-- <instance identity="C1" name="C1" type="C_Type"> -->
<!-- to: -->
<!-- <A_Type identity="A1" name="A1" type="A_Type"> -->
<!-- <B_Type identity="B1" name="B1" type="B_Type"> -->
<!-- <C_Type identity="C1" name="C1" type="C_Type"> -->
<xsl:template match="instance">
<xsl:element name="{@type}">
<xsl:for-each select="@*">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates select="*" />
</xsl:element>
</xsl:template>
<!-- convert each Attribute node into a node that has the same name as the
attribute -->
<!-- from: -->
<!-- <attribute Name="AttA1-1"> -->
<!-- <value>X</value> -->
<!-- </attribute> -->
<!-- to: -->
<!-- <AttA1-1>X</AttA1-1> -->
<xsl:template match="attribute">
<xsl:element name="{@Name}">
<xsl:value-of select="value" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

You can call it with code similar to:

Dim xslt As New XslTransform
xslt.Load("lgbjr.xslt")
xslt.Transform("lgbjr.xml", "lgbjr.output.xml", Nothing)
Dim ds As New DataSet
ds.ReadXml("lgbjr.output.xml")

I've only minimally tested the above template, as your sample data is not as
well formed as the description you gave...

Hope this helps
Jay

| Hi All,
|
| I've been given an XML file (12 MB) that I need to extract data from. The
| XML file makes the data easy to view, but the data is impossible to
analyze
| in its current format. I've looked at lots of XMLTextReader stuff and I
| can't seem to figure out how to extract the info that I want. Here's a
quick
| example of the XML format:
|
| <instance identity="A1" name="A1" type="A_Type">
| <attribute Name="AttA1-1">
| <value>
| X
| </value>
| </attribute>
| <instance identity="B1" name="B1" type="B_Type">
| <attribute Name="AttB1-1">
| <value>
| X
| </value>
| </attribute>
| <instance identity="B2" name="B2" type="B_Type">
| <attribute Name="AttB2-1">
| <value>
| X
| </value>
| </attribute>
| <instance identity="C1" name="C1" type="C_Type">
| <attribute Name="AttC1-1">
| <value>
| X
| </value>
| </attribute>
| </instance>
| </instance>
| </instance>
| </instance>
|
| Each A_Type contains several B_Types, and each B_Type contains several
| C_Types and the file contains lots of A_Types. I've shown one attribute
| each, but there are lots of them for each type!
|
| what I'd like to do is load this data into a few tables with Master-Detail
| Releations. So Table A would contain a row for each A_Type plus it's
| attributes (with the Attribute Name as the Column Header). For a given row
| selected in Table A, Table B would show each of the B_Types and it's
| attributes, etc.
|
| So, is there an easy way to get the data from the file using an
| XMLTextReader or some other nifty XML tool, or is this going to be a brute
| force method with regular expressions and do loops?
|
| I'm not sure if I've supplied enough info, so if you need to know
something
| else before you can give me an answer, please let me know!! If it's going
to
| be brute force, that's fine, but I'd hate to spend a few days coding, only
| later to find out that there was a quick way to do this!
|
| TIA
| Lee
|
|
 
L

lgbjr

Hi All,

OK, I'm starting to understand a bit of what I need to do (and why). When I
add the XML file to the project, open it, then right click in the view and
select View Data Grid, I get an error that says "The Table (instance) cannot
be the child table to itself in nested relations. this makes sense based on
the way the XML file is setup.

So, I need to do as Jay recommended, which is to transform each instance to
its type and each attribute to its name. Then, each instance will be a table
(multiples of the same instance will be rows in the table) and each
attribute in an instance will be a column in the table.

So, I'm working with Jay's XSLT file as a start and am using the bit of code
that he supplied to load the XSLT file, then do the transform.

Here's the first problem. when I run the transform, I get an exception:

The empty string '' is not a valid name.

And the output XML file is obviously incomplete.

This is the top of the XML file that I want to transform:

<?xml version="1.0" ?>
<top>
<model mim="CO_BSSMIM" name="MIB_BSS_BSS_TaiZhouBSS01_133146459903480000"
prefixDN="RMA=Radio_Access_Network" release="UNDEFINED" rootLDN=""
version="2.2">
<instance identity="instance_1151" name="BSS_TaiZhouBSS01" type="BSS">
<attribute name="BSSId">
<datatype>
<string>
<value>
BSS_TaiZhouBSS01
</value>
</string>
</datatype>
</attribute> <instance identity="instance_0" name="RBS_H101"
type="RBS">
<attribute name="RBSId">
<datatype>
<string>
<value>
RBS_H101
</value>
</string>
</datatype>
</attribute> <attribute name="RBSModel">
<datatype>
<enumRef name="RBSModelType">
<value>
1
</value>
</enumRef>
</datatype>
</attribute> <attribute name="SectorConfiguration">
<datatype>
<enumRef name="SectorConfigurationType">
<value>
0
</value>
</enumRef>
</datatype>
</attribute>

this is the output XML file:

<?xml version="1.0" encoding="utf-8"?><lgbjr>

<BSS

There are no trailing spaces in the input XML file. The transform is failing
at the first transformation. Can someone tell me why?

thanks!!

Lee
 
J

Jay B. Harlow [MVP - Outlook]

lgbjr,
The error itself is because I used "Name" for the "name" attribute of
Attributes.

However once that is fixed you will have another problem, your original XML
did not include the "type" nodes for Attributes.

Your original XML had:

| > | <attribute Name="AttB1-1">
| > | <value>
| > | X
| > | </value>
| > | </attribute>

While your "actual" XML has:

| <attribute name="BSSId">
| <datatype>
| <string>
| <value>
| BSS_TaiZhouBSS01
| </value>
| </string>
| </datatype>
| </attribute>

Notice the <datatype> & <string> nodes in the above. Also it appears your
original includes both a document node of <top> and another node of <model>.

Here is an updated XSLT:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- handle the document/root node of the input -->
<xsl:template match="/">
<xsl:apply-templates select="*" />
</xsl:template>
<!-- copy the top node "as is" -->
<xsl:template match="top">
<xsl:element name="top">
<xsl:copy-of select="@*" />
<xsl:apply-templates select="*" />
</xsl:element>
</xsl:template>
<!-- copy the model node "as is" -->
<xsl:template match="model">
<xsl:element name="model">
<xsl:copy-of select="@*" />
<xsl:apply-templates select="*" />
</xsl:element>
</xsl:template>
<!-- convert each instance node into a node that is the same as the Type
attribute -->
<xsl:template match="instance">
<xsl:element name="{@type}">
<xsl:copy-of select="@*" />
<xsl:apply-templates select="*" />
</xsl:element>
</xsl:template>
<!-- convert each Attribute node into a node that has the same name as the
attribute -->
<xsl:template match="attribute">
<xsl:element name="{@name}">
<xsl:attribute name="xsi:type"
namespace="http://www.w3.org/2001/XMLSchema-instance">
<xsl:choose>
<xsl:when test="local-name(datatype/*)='enumRef'">
<xsl:value-of select="datatype/*/@name" />
</xsl:when>
<xsl:blush:therwise>
<xsl:value-of select="local-name(datatype/*)" />
</xsl:blush:therwise>
</xsl:choose>
</xsl:attribute>
<xsl:value-of select="datatype/*/value" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

NOTE: I simply copy the <top> & <model> nodes as is. I "preserve" the type
of the individual Attributes, as an attribute of that Attribute.

This:
| <attribute name="BSSId">
| <datatype>
| <string>
| <value>
| BSS_TaiZhouBSS01
| </value>
| </string>
| </datatype>
| </attribute>

Becomes this:

<BSSId type="string">BSS_TaiZhouBSS01</BSSId>

Note: The type attribute in the above, should probably be xsi:type!

Instead of:
<xsl:element name="{@name}">
<xsl:attribute name="xsi:type"
namespace="http://www.w3.org/2001/XMLSchema-instance">

You can use:
<xsl:element name="{@name}">
<xsl:attribute name="type">

To remove all of the xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
in the output, ideally xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
should be included once on <top>.

Hope this helps
Jay


| Hi All,
|
| OK, I'm starting to understand a bit of what I need to do (and why). When
I
| add the XML file to the project, open it, then right click in the view and
| select View Data Grid, I get an error that says "The Table (instance)
cannot
| be the child table to itself in nested relations. this makes sense based
on
| the way the XML file is setup.
|
| So, I need to do as Jay recommended, which is to transform each instance
to
| its type and each attribute to its name. Then, each instance will be a
table
| (multiples of the same instance will be rows in the table) and each
| attribute in an instance will be a column in the table.
|
| So, I'm working with Jay's XSLT file as a start and am using the bit of
code
| that he supplied to load the XSLT file, then do the transform.
|
| Here's the first problem. when I run the transform, I get an exception:
|
| The empty string '' is not a valid name.
|
| And the output XML file is obviously incomplete.
|
| This is the top of the XML file that I want to transform:
|
| <?xml version="1.0" ?>
| <top>
| <model mim="CO_BSSMIM" name="MIB_BSS_BSS_TaiZhouBSS01_133146459903480000"
| prefixDN="RMA=Radio_Access_Network" release="UNDEFINED" rootLDN=""
| version="2.2">
| <instance identity="instance_1151" name="BSS_TaiZhouBSS01" type="BSS">
| <attribute name="BSSId">
| <datatype>
| <string>
| <value>
| BSS_TaiZhouBSS01
| </value>
| </string>
| </datatype>
| </attribute> <instance identity="instance_0" name="RBS_H101"
| type="RBS">
| <attribute name="RBSId">
| <datatype>
| <string>
| <value>
| RBS_H101
| </value>
| </string>
| </datatype>
| </attribute> <attribute name="RBSModel">
| <datatype>
| <enumRef name="RBSModelType">
| <value>
| 1
| </value>
| </enumRef>
| </datatype>
| </attribute> <attribute name="SectorConfiguration">
| <datatype>
| <enumRef name="SectorConfigurationType">
| <value>
| 0
| </value>
| </enumRef>
| </datatype>
| </attribute>
|
| this is the output XML file:
|
| <?xml version="1.0" encoding="utf-8"?><lgbjr>
|
| <BSS
|
| There are no trailing spaces in the input XML file. The transform is
failing
| at the first transformation. Can someone tell me why?
|
| thanks!!
|
| Lee
|
| | > lgbjr,
| > I would consider using an XSLT transform to transform your input data
into
| > something a little more DataSet friendly. Here is the start of such a
| > transform:
| >
| > <?xml version="1.0" encoding="UTF-8" ?>
| > <xsl:stylesheet version="1.0"
| > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
| > <!-- handle the document/root node of the input -->
| > <xsl:template match="/">
| > <xsl:element name="lbgjr">
| > <xsl:apply-templates select="*" />
| > </xsl:element>
| > </xsl:template>
| > <!-- convert each instance node into a node that is the same as the Type
| > attribute -->
| > <!-- from: -->
| > <!-- <instance identity="A1" name="A1" type="A_Type"> -->
| > <!-- <instance identity="B1" name="B1" type="B_Type"> -->
| > <!-- <instance identity="C1" name="C1" type="C_Type"> -->
| > <!-- to: -->
| > <!-- <A_Type identity="A1" name="A1" type="A_Type"> -->
| > <!-- <B_Type identity="B1" name="B1" type="B_Type"> -->
| > <!-- <C_Type identity="C1" name="C1" type="C_Type"> -->
| > <xsl:template match="instance">
| > <xsl:element name="{@type}">
| > <xsl:for-each select="@*">
| > <xsl:attribute name="{local-name(.)}">
| > <xsl:value-of select="." />
| > </xsl:attribute>
| > </xsl:for-each>
| > <xsl:apply-templates select="*" />
| > </xsl:element>
| > </xsl:template>
| > <!-- convert each Attribute node into a node that has the same name as
the
| > attribute -->
| > <!-- from: -->
| > <!-- <attribute Name="AttA1-1"> -->
| > <!-- <value>X</value> -->
| > <!-- </attribute> -->
| > <!-- to: -->
| > <!-- <AttA1-1>X</AttA1-1> -->
| > <xsl:template match="attribute">
| > <xsl:element name="{@Name}">
| > <xsl:value-of select="value" />
| > </xsl:element>
| > </xsl:template>
| > </xsl:stylesheet>
| >
| > You can call it with code similar to:
| >
| > Dim xslt As New XslTransform
| > xslt.Load("lgbjr.xslt")
| > xslt.Transform("lgbjr.xml", "lgbjr.output.xml", Nothing)
| > Dim ds As New DataSet
| > ds.ReadXml("lgbjr.output.xml")
| >
| > I've only minimally tested the above template, as your sample data is
not
| > as
| > well formed as the description you gave...
| >
| > Hope this helps
| > Jay
| >
| > | > | Hi All,
| > |
| > | I've been given an XML file (12 MB) that I need to extract data from.
| > The
| > | XML file makes the data easy to view, but the data is impossible to
| > analyze
| > | in its current format. I've looked at lots of XMLTextReader stuff and
I
| > | can't seem to figure out how to extract the info that I want. Here's a
| > quick
| > | example of the XML format:
| > |
| > | <instance identity="A1" name="A1" type="A_Type">
| > | <attribute Name="AttA1-1">
| > | <value>
| > | X
| > | </value>
| > | </attribute>
| > | <instance identity="B1" name="B1" type="B_Type">
| > | <attribute Name="AttB1-1">
| > | <value>
| > | X
| > | </value>
| > | </attribute>
| > | <instance identity="B2" name="B2" type="B_Type">
| > | <attribute Name="AttB2-1">
| > | <value>
| > | X
| > | </value>
| > | </attribute>
| > | <instance identity="C1" name="C1" type="C_Type">
| > | <attribute Name="AttC1-1">
| > | <value>
| > | X
| > | </value>
| > | </attribute>
| > | </instance>
| > | </instance>
| > | </instance>
| > | </instance>
| > |
| > | Each A_Type contains several B_Types, and each B_Type contains several
| > | C_Types and the file contains lots of A_Types. I've shown one
attribute
| > | each, but there are lots of them for each type!
| > |
| > | what I'd like to do is load this data into a few tables with
| > Master-Detail
| > | Releations. So Table A would contain a row for each A_Type plus it's
| > | attributes (with the Attribute Name as the Column Header). For a given
| > row
| > | selected in Table A, Table B would show each of the B_Types and it's
| > | attributes, etc.
| > |
| > | So, is there an easy way to get the data from the file using an
| > | XMLTextReader or some other nifty XML tool, or is this going to be a
| > brute
| > | force method with regular expressions and do loops?
| > |
| > | I'm not sure if I've supplied enough info, so if you need to know
| > something
| > | else before you can give me an answer, please let me know!! If it's
| > going
| > to
| > | be brute force, that's fine, but I'd hate to spend a few days coding,
| > only
| > | later to find out that there was a quick way to do this!
| > |
| > | TIA
| > | Lee
| > |
| > |
| >
| >
|
|
 
L

lgbjr

Hi Jay,

Thank you very much for the help. I've been using VB.NET for 2 years now, so
I've been surrounded by XML, but never actually used it! Now I've got a
requirement to use it and I'm having to jump in with both feet. I'm sure
that playing with all of the nice little examples in the docs and on the web
would have eventually gotten me to this point, but honestly, now, I just
don't have the time. Once I get this finished, I'll go back and do the step
by step stuff (which I'm sure will lead to a whole set of new questions!)
Thanks for getting me in the fast lane on this stuff. I appreciate that your
posts include not only code, but comments as to why certain things are
there. This makes a big difference to me as it's easier to understand why
things are done a certain way.

Sorry for not including the same XML code in the original post. Again, as
this is new to me, I didn't really know what was important and what wasn't.
I opted for being as brief as possible the first time. Now, I know better!

Thanks Again,
Lee
 
L

lgbjr

Hi Jay,

OK, so far, so good. Using your XSLT as a start, I added some more
transforms (for things that where not included in the previous posts. So,
the XSLT works, I can read the resulting XML file (dataset.ReadXML), and I
can create an XSD file (dataset.WriteXmlSchema). As a test, I imported the
resulting Schema into Access, then imported the XML file (append data to
exisiting tables) and everything looks good.

After seeing that the results were good, I went back to my small transform
app and added a shell to XSD.exe to generate a typed dataset from the XSD
file.

Now, my thinking is that using a typed data set is the easiest way to go for
use in a new app. I just add the typed dataset, and the rest is pretty easy.
But, of course, as soon as I realize something will be easy, it doesn't
work!! XSD.exe creates a vb file that I added to a new app. then I dropped a
dataset on my form and selected the typed dataset, but I get an error saying
"Exception has been thrown by the target of an invocation". Not very
descriptive!!

Now, temporarily, forgetting the typed dataset, if I do a dataset.readxml, I
have to dynamically create each table and column and relationship that I
want to see in a grid. If I add the XSD file to my project, how can I use
the tables/columns/relationships defined in the XSD file? Or can I only do
this with a typed dataset created from the XSD file?

TIA,
Lee
 
J

Jay B. Harlow [MVP - Outlook]

Lee,
Rather then use XSD.exe to explicitly create the typed dataset, I would
simply add the .XSD itself (the one created by DataSet.WriteXmlSchema) to my
project. I would then open the .XSD file, right click & select "Generate
DataSet".

This implicitly creates a typed dataset.

Hope this helps
Jay

| Hi Jay,
|
| OK, so far, so good. Using your XSLT as a start, I added some more
| transforms (for things that where not included in the previous posts. So,
| the XSLT works, I can read the resulting XML file (dataset.ReadXML), and I
| can create an XSD file (dataset.WriteXmlSchema). As a test, I imported the
| resulting Schema into Access, then imported the XML file (append data to
| exisiting tables) and everything looks good.
|
| After seeing that the results were good, I went back to my small transform
| app and added a shell to XSD.exe to generate a typed dataset from the XSD
| file.
|
| Now, my thinking is that using a typed data set is the easiest way to go
for
| use in a new app. I just add the typed dataset, and the rest is pretty
easy.
| But, of course, as soon as I realize something will be easy, it doesn't
| work!! XSD.exe creates a vb file that I added to a new app. then I dropped
a
| dataset on my form and selected the typed dataset, but I get an error
saying
| "Exception has been thrown by the target of an invocation". Not very
| descriptive!!
|
| Now, temporarily, forgetting the typed dataset, if I do a dataset.readxml,
I
| have to dynamically create each table and column and relationship that I
| want to see in a grid. If I add the XSD file to my project, how can I use
| the tables/columns/relationships defined in the XSD file? Or can I only do
| this with a typed dataset created from the XSD file?
|
| TIA,
| Lee
|
<<snip>>
 
L

lgbjr

Hi Jay,

Yep, that works! Quick question: I'm actually doing this project in 2003 and
2005 at the same time (just to see the differences. In 2005, if I
right-click on the XSD view, there isn't a "Generate Dataset" option.

Any ideas on how to proceed in 2005?

Thanks!

Lee
 
L

lgbjr

HI Jay,

Actually I sent the last post a buick to quick. what I see in 2005 is that
the XSD file already looks like a dataset (meaning that when I view the XSD
file, the toolbox items that are available are listed under the heading of
"Dataset" and are items that one would add to a dataset, such as table
adapters, data tables, etc.). However, the project does not have a data
source. So, if I add a grid or some other control that I can bind to the
data, the datasource selection shows "None".

So, how do I get the XSD file in 2005 to show as a data source?

Thanks
Lee
 
P

Peter Huang [MSFT]

Hi

Since VS.NET 2005(Whidbey) has not been released, so far for Whidbey issue,
we have newsgroup about Whidbey.
microsoft.beta.whidbey.*

Thanks for your understanding!

If you still have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jay B. Harlow [MVP - Outlook]

Lee,
You can ask 2005 specific questions at: http://forums.microsoft.com/msdn/

There was a post recently in microsoft.beta.whidbey.* that they are being
closed in favor of the above forums which IMHO is a mistake. Hopefully I
miss read the post...


My understanding is that both 2003 & 2005 using the msdata:IsDataSet
attribute (in the XSD itself) to identify the .xsd file as a "DataSet" or
not. I am not seeing an obvious way of setting that attribute.

The "Generate DataSet" command in 2003 actually sets the Custom Tool in the
properties for the file itself (select the file in Solution Explorer & look
at its properties).

You may want to ask in the above 2005 forums on how to add the dataset as a
datasource...

Hope this helps
Jay


| HI Jay,
|
| Actually I sent the last post a buick to quick. what I see in 2005 is that
| the XSD file already looks like a dataset (meaning that when I view the
XSD
| file, the toolbox items that are available are listed under the heading of
| "Dataset" and are items that one would add to a dataset, such as table
| adapters, data tables, etc.). However, the project does not have a data
| source. So, if I add a grid or some other control that I can bind to the
| data, the datasource selection shows "None".
|
| So, how do I get the XSD file in 2005 to show as a data source?
|
| Thanks
| Lee
|
| | > Hi Jay,
| >
| > Yep, that works! Quick question: I'm actually doing this project in 2003
| > and 2005 at the same time (just to see the differences. In 2005, if I
| > right-click on the XSD view, there isn't a "Generate Dataset" option.
| >
| > Any ideas on how to proceed in 2005?
| >
| > Thanks!
| >
| > Lee
| >
message
| > | >> Lee,
| >> Rather then use XSD.exe to explicitly create the typed dataset, I would
| >> simply add the .XSD itself (the one created by DataSet.WriteXmlSchema)
to
| >> my
| >> project. I would then open the .XSD file, right click & select
"Generate
| >> DataSet".
| >>
| >> This implicitly creates a typed dataset.
| >>
| >> Hope this helps
| >> Jay
| >>
<< snip >>
 
L

lgbjr

Hi Jay and Peter,

Yeah, I know about the Whidbey groups and AFAIK they are switching to the
forums, which I agree, is a mistake. I was just being lazy.

However, I did figure out the problem (as a workaround). If I add a new
dataset to the project, open the XSD file that was created with
DS.WriteXmlSchema, then copy/paste the contents into the new dataset, the
new dataset works as it should.

Regards,

Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top