简体   繁体   English

如何从没有Web服务器的文本框中读取数据,然后将其保存在XML文件中?

[英]How can I read data from a textbox with no web server, then save it in an XML file?

I am studying computer science and we have to do a programming project which must be strongly related to XML and using XSD and XSLT or XQuery/XPath at least. 我正在学习计算机科学,因此我们必须做一个编程项目,该项目必须与XML紧密相关,并且至少要使用XSD和XSLT或XQuery / XPath。 Because I like C# I'd like to do it in this language, but I could use another if anyone has another idea. 因为我喜欢C#,所以我想用这种语言来做,但是如果有人有其他想法,我可以使用其他语言。

My Idea is now to code some kind of appointment book. 我的主意现在是编写某种约会簿。 I imagine that all appointments for the week are shown as HTML and you can enter for each day appointment notes in the textarea for this day. 我想一周的所有约会都以HTML格式显示,您可以在文本区域中输入当天的每天约会记录。

Now my question: How can I take over the data entered in the textboxes? 现在我的问题是:如何接管在文本框中输入的数据? The application is an offline one so I have no web server receiving the GET request containing the entered data. 该应用程序是一个脱机应用程序,因此我没有Web服务器接收包含输入数据的GET请求。 Is it possible to read the current HTML DOM from memory with all its entered values and then transform it to an XML format for persistent storage from which it could be read in later? 是否可以从内存中读取具有所有输入值的当前HTML DOM,然后将其转换为XML格式以进行持久存储,以便以后可以从中读取?

Or is this idea totally stupid? 还是这个想法完全愚蠢?

How else can I put all those XML technologies in one app? 我还能如何将所有这些XML技术集成到一个应用程序中?

Why does it have to be Web based? 为什么必须基于Web?

You can use those technologies in a Windows Application. 您可以在Windows应用程序中使用这些技术。

You can use JavaScript. 您可以使用JavaScript。 Convert the data into XML or JSON and output it to another element, like div, or textarea. 将数据转换为XML或JSON,然后将其输出到另一个元素,例如div或textarea。 What you need to do is set a function that does all this and gets executed on submit. 您需要做的是设置一个函数来执行所有这些操作并在提交时执行。

Check this example . 检查此示例 Also to speed things up, you can use a library like jQuery . 为了加快速度,您可以使用jQuery之类的库。

If you want to show UI Generation from XSLT, the web page approach is easiest. 如果要显示XSLT的UI生成,则最简单的方法是网页方法。

More impressive is generation of XAML from XSLT -> windows app (WPF). 更令人印象深刻的是从XSLT-> Windows应用程序(WPF)生成XAML。

Download Visual Web Developer (FREE) or Visual C# 下载Visual Web Developer(免费)Visual C#

Being at home and offline do not mean you don't have a Web server. 在家中和脱机并不意味着您没有Web服务器。 There are zillions of ready-made packages which offer an embedded HTTP server so that the same application can run online and offline without any modification. 有成千上万个提供嵌入式HTTP服务器的现成软件包,因此同一应用程序可以在线和离线运行而无需进行任何修改。 Very convenient. 很方便。

(I know you us C# but, just to show an example, I use wsgiref.simple_server for that purpose.) (我知道您使用的是C#,但是,为了举例说明,我为此使用wsgiref.simple_server 。)

Why not make a windows app that allows the user to update the appointments which are stored in an XML file. 为什么不制作一个Windows应用程序,该应用程序允许用户更新存储在XML文件中的约会。 Then use a stylesheet to display the appointments in a web browser. 然后使用样式表在Web浏览器中显示约会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将数据从Windows窗体保存到XML文件? - How can I save data from a Windows Form to an XML file? 如何将列表框中的数据及其文本框中的相应值保存到xml中 - How to save data from a listbox and its corresponding value in a textbox into an xml 如何将URL中的XmL数据保存到数据库中 - how can i save XmL data from a URL into my database 如何从ASP.NET Web API发布请求中读取文件数据? - How can I read the file data from an ASP.NET web API post request? 如何从XML或文本文件读取特定数据? - How can I read specific data from XML or Text files? 从组合框选择项目后,将数据从xml文件提取到文本框。 如何做到这一点? - Fetch data from xml file to textbox on selecting an item from combobox. How can this be achieved? C#/ WPF如何从文本框读取“绑定”(数据从SQL表获取)? - C#/WPF How can I read “Bindings” from a TextBox (Data gets from a SQL-Table)? 如何在WPF中使用XmlDataProvider从TextBox中添加XML文件中的节点 - How can I add a node in XML file from TextBox using XmlDataProvider in WPF 如何从另一个网站保存和读取xml文件? - How to save and read a xml file from another website? 如何将 XDocument 的 XML 内容保存为 .xml 文件? - How can I save the XML contents of an XDocument as an .xml file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM