I
I
Ivan Vyrov2017-08-04 06:22:32
C++ / C#
Ivan Vyrov, 2017-08-04 06:22:32

How to generate form from xml?

Good afternoon, connoisseurs!
please tell me how to implement form generation (WinForm) in C# from XML schemas

Approximately this kind, pulled out from another project
<CONTENT_MODEL dfattchfiles="|Document|files" dfnumberdoc="|Document|Число_регномера" key="Key">
    <E name="Key" datatype="integer" index="false" default="&quot;1&quot;" view="invisible" displayname="Ключ" dfprotected="true"/>
    <S name="Document" use="Входящие" displayname="Документ"><E displayname="Регистрационный номер" name="Регистрационный_номер" datatype="text(249)" index="true" dfprotected="true" dfhidden="true"/>
      <E displayname="Порядковый рег. номер" name="Число_регномера" datatype="integer(+1..)" index="true" view="invisible" dfprotected="true" required="true"/>
      <E displayname="Дата регистрации" name="Дата_регистрации" datatype="date" edit="" index="true" dfprotected="true" required="true" esp="false" default="nowdate()"/>
      <E displayname="Вид документа" name="Вид_документа" datatype="dictionary(VidDocNames,text)" index="true" dfprotected="true" required="false" edit="combobox"/>
      <E displayname="Краткое содержание" name="Краткое_содержание" datatype="longtext" euflag="7" index="true" dfprotected="true" required="true" edit="multiline" awindex="true"/>
      <E displayname="Имя потока" name="Имя_потока" datatype="text" index="false" view="invisible" dfprotected="true" dfhidden="true" esp="false"/>
....


If you have in mind links with a description of such actions, please throw off.
Push for a good article...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kuznetsov, 2017-08-04
@DarkRaven

Your document is a description of a data model with values, apparently.
The data model describes what columns you should have.
You just need to loop through all the columns from your document and build from, depending on the type.
There is no silver bullet, of course.
A close example of the approach: https://stackoverflow.com/a/2016113/2822609
On my own, this example just shows how this can be achieved. Take properties, generate controls for them, add values ​​and links. All.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question