I've been given a file which has xml. I'm trying to get the file to create a typed dataset so I can access its contents easily and nicely. I've run xsd.exe against the xml file and produced an xsd file no errors reported. I then brought the xsd file into my C# project in VS 2005/.net 2. That all works ok as well.
Now I try to add a dataset from the tools window and it asks if I want it untyped or typed based on my xsd file. I go for typed and get a TargetInvocationException. The error doesn't say what caused it, just that it got the exception. I do get soime errors and messages in the error list window of VS though -
Warning 1 The 'homePlayers_Constraint1' identity constraint is not declared. D:\My Documents\Visual Studio Projects\DMCIT_AFL\DSAFL_SummaryStats.xsd 140 6 DMCIT_AFL Warning 2 The 'awayPlayers_Constraint1' identity constraint is not declared. D:\My Documents\Visual Studio Projects\DMCIT_AFL\DSAFL_SummaryStats.xsd 144 6 DMCIT_AFL Warning 3 The 'SchemaSerializationMode' attribute is not declared. D:\My Documents\Visual Studio Projects\DMCIT_AFL\DSAFL_SummaryStats.xsd 5 139 DMCIT_AFL Warning 101 The maximum number of errors or warnings has been reached. D:\My Documents\Visual Studio Projects\DMCIT_AFL\DSAFL_SummaryStats.xsd 149 13 DMCIT_AFL Error 102 Custom tool error: Failed to generate code. Unable to convert input xml file content to a DataSet. The 'homePlayers_Constraint1' identity constraint is not declared. The 'homePlayers_Constraint1' identity constraint is not declared. D:\My Documents\Visual Studio Projects\DMCIT_AFL\DSAFL_SummaryStats.xsd 1 1 DMCIT_AFL
I'm not all that familiar with xml so any help would be appreciated. My guesses are that the xml isn't formed properly or that it just has something that xsd.exe can't deal with.
Found a work around. Seem that the xml had two teams that had records called "player". The xsd file and VS2005 made this all look OK but when you try to make a dataset put of it it goes to fooot. I changed the player records to be home_team_player and away_team_player so that there wasn't two tables connected to the one and it all works fine... Hope the guy supplying the xml agrees to change the xml output.
If anyone has any comment on any of this please let me know. As I said before, I'm a XML wiener!