Javascript 从 XML 创建 HTML 表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3736658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 05:56:49  来源:igfitidea点击:

Create HTML form from XML

javascripthtmlxml

提问by Mark Pope

I have a number of different xml files that I need to edit from an html form. I want the form to be generated dynamically (the files could any valid xml structure) and I want to save the modified xml content back to the database in the same structure.

我有许多不同的 xml 文件,需要从 html 表单中进行编辑。我希望动态生成表单(文件可以是任何有效的 xml 结构),并且我希望将修改后的 xml 内容以相同的结构保存回数据库。

I've seen a few examples of using XSLT when you know the structure of the xml, but in this case I don't.

当您知道 xml 的结构时,我已经看到了一些使用 XSLT 的示例,但在这种情况下我不知道。

So, two real points:

所以,两个真实的点:

  1. How do I dynamically create an html form from an unknown xml structure
  2. How do I save the modified content back to the same xml structure
  1. 如何从未知的 xml 结构动态创建 html 表单
  2. 如何将修改后的内容保存回相同的 xml 结构

回答by Troy Moon

I JUST ran across this site the other day, maybe it's what you're looking for...

前几天我刚跑过这个网站,也许这就是你要找的……

http://www.datamech.com/XMLForm/

http://www.datamech.com/XMLForm/

Good Luck!

祝你好运!