XML Form Generator, Part 1: Generating an XML Form

原创 2004年11月03日 08:26:00

[ Download Code ] | [ Run Sample ]
One of the most frequent tasks that web developers receive is that of creating a form to collect user input. One solution is to use an ASP.NET web page to create an XML file that will be used as the basis for a web form. The three part article, XML Form Generator, will demonstrate how to easily create an XML form that will save user input as an XML file. By using the run sample link above you view all the source code and see an online demo.

First, we are going to need a web page that will create an XML files (XML forms) in this format:

<?xml version="1.0" standalone="yes"?>
    <Label>Operating System</Label>
    <Text>Windows 98,Windows XP,Other</Text>
  . . . . . 

Here is the explanation of the fields:

  • Control - The type of ASP.NET web server control
  • Data - The type of data that the form will take as input
  • Required - Is the field required
  • Order - The order that the fields will be displayed in the form
  • Label - The field label that is displayed on the form
  • Id - The ASP.NET web server control id
  • Text - This field is use in multiple ways:
    • For TextBox, Multiline, Hidden, Password and Label controls this is the default value (Note: Multiline, Hidden, Password are all TextBox controls)
    • For DropDownList, RadioButtonList and CheckBoxList and ListBox controls a comma separated list will be displayed as separate items
    • For a CheckBox control it the text displayed next to it

How to run the sample:

  1. Download and extract the files to a virtual directory.
  2. Use your web browser to navigate to the XmlFormGen.aspx file in that virtual directory.
  3. To load the included test form type in Test.xml and click the Load Form button.
  4. To create a new form type in the name of the form and add a .xml extension. Then click on the New Form button.
  5. You can now edit, delete, and add fields on you form.

That's all there is to creating a form. I know what you're thinking, all this does is create XML files. But, it actually creates a very specific kind of XML file that I am calling an XML form. The next part of this series will demonstrate how we can use these XML forms to capture user input and save the results to XML files.

Form 2 xml(将form内容转换成XML格式 )转

将form内容转换成XML格式 /* 函数名: strfrmtoxml作用:  将Form数据转换成XML形式,用于XMLHTTP传输调用方式: var strxml=strfrmtoxml(From...
  • hyde82
  • hyde82
  • 2005年11月27日 02:10
  • 1183


通常,在asp中进行的form表单提交的数据都被写进数据库管理系统中去,如果你想要你的数据是方便携带的数据,你可以把它写进一个XML文件中去。这种方法是跨平台的,因此你所收集的信息不需要进行转换。 ...
  • bpvwj
  • bpvwj
  • 2014年04月22日 18:48
  • 1358

http post xml 表单提交(application/x-www-form-urlencoded)

http post xml 表单提交(application/x-www-form-urlencoded) 原报文     1     SP1712011545899767809_17120...
  • zy52002520
  • zy52002520
  • 2017年12月04日 10:20
  • 108


分类: JAVA学习笔记2013-01-16 16:56354人阅读评论(0)收藏举报 在使用eclipse和tomcat 7.0开发web项目的时候,上传文件的表单常常需要使用servlet来处...
  • diaoguangqiang
  • diaoguangqiang
  • 2013年12月13日 09:19
  • 1110

XmlSerialize error: There was an error generating the XML document.

今天遇到一个很火的问题, 一个c#的class 序列化成xml后抛出异常, 信息为:  XmlSerialize error: There was an error generating the XM...
  • muzizongheng
  • muzizongheng
  • 2013年07月10日 15:41
  • 1240


  • shanyou
  • shanyou
  • 2004年04月05日 23:41
  • 1470

HTML5第8次课堂笔记( 模拟form表单提交数据,xml的解析,jQuery的Ajax方法使用, mui的ajax)

HTML5第8次课堂笔记   1.  模拟form表单提交数据:(get方式)   body>   form method="get"action="DataTest7">   input type=...
  • u013267266
  • u013267266
  • 2016年04月21日 19:12
  • 3509


1、表单提交方式 * 使用submit提交 ...... * 使用button提交表单 - 代码 // 实现提交方法 function form1(){ //获取form...
  • jstough
  • jstough
  • 2016年11月12日 15:21
  • 1060

mybatis generator xml配置模板

  • heiyouhei123
  • heiyouhei123
  • 2017年05月09日 09:34
  • 687

Bootstrap (Web前端CSS框架)—Form Builder and Generator

http://www.bootcss.com/ http://www.runoob.com/bootstrap/bootstrap-tutorial.html http://bootsni...
  • ztguang
  • ztguang
  • 2016年02月01日 00:00
  • 746
您举报文章:XML Form Generator, Part 1: Generating an XML Form