简体   繁体   English

将字符串的内容保存在 xml 中并再次读取 xml 文件

[英]Saving a the contents of string in a xml and reading the xml file again

I have a HTML page which contains users data and the data is stored in tags, I have selected particular div tags and saved as a string using java servlet now I need to save those strings in a xml file.我有一个 HTML 页面,其中包含用户数据并且数据存储在标签中,我选择了特定的 div 标签并使用 java servlet 保存为字符串,现在我需要将这些字符串保存在 Z0F635D0E0F38274FFF8BZ581C1C1 文件中I am newbie to java I was able to generate a xml file and add some contents to it, it was experimental project.我是 java 的新手,我能够生成一个 xml 文件并向其中添加一些内容,这是一个实验项目。

In the real time I have the above scenario and once I store the store those strings in a xml I need to read that back and present it as HTML to the broswers在实时我有上述场景,一旦我将这些字符串存储在 xml 中,我需要将其读回并将其作为 HTML 呈现给浏览器

You can use Java Architecture for XML Binding (JAXB).您可以将Java Architecture for XML Binding (JAXB)。 You can create simple POJO file with all the properties of User.您可以使用 User 的所有属性创建简单的 POJO 文件。

Reading and writing is done on the back hand by JAVA.读写由JAVA在背面完成。

A very simple JAXB tutorial is available here .此处提供了一个非常简单的 JAXB 教程。

You can find many other useful articles on web.您可以在 web 上找到许多其他有用的文章。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM