"Dan" <(E-Mail Removed)> wrote in
news:u#(E-Mail Removed):
> Hi,
>
> Can I use the designer to create a typed DataSet and then use it to
> parse xml file?
>
> If yes, could someone please describe the necessary steps or point me
> to on-line docs?
>
> For example, how would I define a DataSet in the designer for the
> following xml:
> [...]
> <parent>
> <parent_id>1</parent_id>
> <name>parent1</name>
> <child>
> <child_id>1</child_id>
> <name>child1</name>
> </child>
> <child>
> <child_id>2</child_id>
> <name>child2</name>
> </child>
> </parent>
> <parent>
> [...]
> </parent>
>
> I'd appreciate _any_ suggestions.
Yes and no.
Earlier versions of Visual Studio had better features for creating an
XML Schema and not merely a DataSet. If you are aiming for XML schema,
you might find your designed schema is not accurate. If, however, a
DataSet is what you are testing against, then you should be fun. That is
the designer gotcha.
As for validation, Scott's suggestion will work, since your XSD is a
DataSet. If it fails to load, it is not valid.
But, that is not the answer you want. You can also use a validating
reader and add the schema in question to the reader. This will validate
the XML to schema, while giving you some clue of why the XML is not
valid (loading a DataSet merely gives an exception).
Peace and Grace,
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
My vacation and childhood cancer awareness site:
http://www.crazycancertour.com
*******************************************
| Think outside the box! |
*******************************************