Can i generate a web form from XML Schema(xsd)?
Locked
-
Wednesday, December 23, 2009 12:47 PMHello,<!-- / message -->
I have an xml schema file (.xsd) , can anyone suggest how i could turn this into a web form so users can input values.
The problem i have is that the xsd file has some fields that require an insert/delete operation, so i simple html form wont work. I have looked a little at xforms but could never get it to work.
I have also looked at aspx but no look so far.
I have read that it is possible to convert the .xsd to a .cs file using xsd.exe and then use a objectDataSource to connect to a display view but i have had no luck doing this. I managed to convert the xsd file however when i try to link to the objectdatasource it requires SELECT, INSERT, DELETE etc functions and i have no idea what i should do. Can these functions be generated automatically?
Any help would be great.
Thanks
Here is my xsd file:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="EventList">
<xs:complexType>
<xs:sequence>
<xs:element name="ExerciseName" type="xs:string"/>
<xs:element name="ExerciseDescription" type="xs:string"/>
<xs:element name="Events" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="EventName" type="xs:string"/>
<xs:element name="EventDescription" type="xs:string"/>
<xs:element name="Incidents" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="IncidentName" type="xs:string"/>
<xs:element name="IncidentDescription" type="xs:string"/>
<xs:element name="Injects" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="InjectName" type="xs:string"/>
<xs:element name="InjectDescription" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
All Replies
-
Wednesday, December 23, 2009 1:50 PM
Assuming you have infrastructure and the deployment model fits, Microsoft's InfoPath (Forms Services) is your best choice. I haven't seen anything else that would work reasonably well in this space (XSD to forms) and be affordable.
However, there are numerous tools that would build a form to fill in data in a relational model. Assuming you can go there, it shouldn't be hard to automate the generation of a relational model from your XSD (you can start by trying out XSD to DataSet in .NET).- Marked As Answer by Ed PintoMicrosoft Employee, Moderator Friday, January 08, 2010 2:47 AM
-
Wednesday, December 23, 2009 2:43 PMHi Petru,
I have managed to generate a c# dataset using xsd.exe however i am unsure how to use this data set to generate a form/gui.
I did try infopath and it generated a form however i am not using sharepoint, my site is using Apache and MySQL.
Thanks -
Wednesday, December 23, 2009 3:36 PM
I would do the following: When you generate a DataSet from an XML Schema using the API (not the xsd.exe) you get a set of tables and PK-FK relationships among them that are needed to navigate this set. You would then need to convert those into DDL (see this to get an idea http://stackoverflow.com/questions/1348712/creating-a-sql-server-table-from-a-c-datatable, even though is specific to SQL Server) and run it on your database. This gives you the database.
Secondly, tools like Ironspeed would take it to the next level (I am not affiliated with them in any way).
This at least would give you an understanding of what this is all about.
Assuming that you find tools such as Ironspeed good for your needs, you may asses that maybe doing the whole database design by hand is much easier than going through XSD->DataSet->DDL. Keep in mind that for complex schema, XSD->DataSet might not work due to limitations in the API.
I don't mean to confuse you, but the question you raised doesn't have a simple answer for all but trivial scenarios.- Marked As Answer by Ed PintoMicrosoft Employee, Moderator Friday, January 08, 2010 2:47 AM

